News:

Huge spam cleanup. I hope, everything important is still in place. :-)

Main Menu

Better image quality

Started by Joana, August 10, 2008, 01:49:53 AM

Previous topic - Next topic

Joana

Hey,

my name's Joana and I'm from Brazil. Nice to meet you.

I've been using CentrED for a week and it's being a wonderful experience since then. The most interesting thing about CentrED is that it's being developed in Pascal and it really runs quite well on linux(I love that). And I was wondering ... why not doing something similar in ruby? so here my story begins:

My question is not about the project itself, it's more like openGL I guess. While playing around with map,  I found that my textures are not being rendered as the same quality as CentrED.

Here's the image:



If you look closely at the grass, you'll notice that mine lacks detail(high quality). How can I fix this? I've tried a bunch of GL procedures but nothing has worked.

Here's my current code

the loading procedure
     GL.TexImage2D(GL::TEXTURE_2D, 0, 4, @width, @height, 0, GL::RGBA, GL::UNSIGNED_BYTE, @buffer)

      GL.TexParameterf(GL::TEXTURE_2D, GL::TEXTURE_MAG_FILTER, GL::NEAREST)
      GL.TexParameterf(GL::TEXTURE_2D, GL::TEXTURE_MIN_FILTER, GL::NEAREST)
      GL.TexParameterf(GL::TEXTURE_2D, GL::TEXTURE_WRAP_S, GL::CLAMP)
      GL.TexParameterf(GL::TEXTURE_2D, GL::TEXTURE_WRAP_T, GL::CLAMP)      

the blitting procedure
     GL.BindTexture(GL::TEXTURE_2D, @texture_id)

      GL.Begin(GL::QUADS)
        GL.TexCoord(0,0); GL.Vertex( x + 0, -height + y )
        GL.TexCoord(1,0); GL.Vertex( x + width, 0 + y )
        GL.TexCoord(1,1); GL.Vertex( 0 + x, height + y )
        GL.TexCoord(0,1); GL.Vertex( x + -width, 0 + y )
      GL.End

Thank you,
Jo

Hitman

Hi,

currently I could only imagine, that you use the wrong textures (it's hard to say, since I can't really see altitudes on these images).
Since I don't know how much you know about the rendering of UO maps, I'll explain that in more detail:

There are up to two graphics for terrain tiles. The default one is in art.mul and represents a flat land tile.
However since land tiles can have different heights, they occasionally need to be stretched. For this purpose, there are higher quality textures in texmaps.mul for some of the tiles.
Only if stretching is needed (i.e. if the southern, western, eastern tile and the tile itself don't have the same Z value), these textures are used.
In case stretching is needed but no texture is available, the tile is drawn unstretched with the normal art.mul graphic at its own Z value (this is for example the case with water tiles ... wouldn't make much sense to stretch them anyway).

Since the colors on your screenshot seem a bit brighter than on mine, I guess you used the texmaps.mul textures in any case (instead of using art.mul graphics for un-stretched tiles) ... because the texmaps are usually a bit brighter.

I hope that already helps, otherwise I'll take another look :-)

Joana

Hi Hitman, how are you?

Thank you for replying :D

The Centred's pic was taken by "disabled statics(art.mul?)" option at the menu.

Despite the brigtness, I think I'm rendering the texture wrongly. If you look carefully you'll see mine looks rather blurry at dirty terrain and grass.  However, the stoned red walk-way looks fine for me.

As far as I understood you and how CentrED do things, we firstly load the base terrain by looking mapx.mul over. Mapx.mul gives us details about which images (from art.mul or texture.mul) and altitude we should place at terrain level. I'm kinda lost here. Was art.mul not supposed to place only "decorations"? Does it also have entries for textures(terrain level)?

After loading the terrain level, we look at the static files in order to know if a given block has some "decorations"(art.mul). If so, we place them accordingly, otherwise we just leave it as it is.

Particularly, In that block, there are only textures 64x64. Everything is at the same altitude.

Thank you again,
Jo

Hitman

art.mul contains both - terrain tiles and static tiles.
The tiles 0x0000 until 0x3FFF are terrain tiles, everything after that are static.
As you probably also know, tiledata.mul contains additional information for each tile. In case of terrain tiles (0x0000 to 0x3FFF) this may give a texture ID. If that ID is > 0, the tile can be stretched.

Stretching is necessary, if the tiles at (x,y), (x+1, y), (x, y+1) and (x+1, y+1) don't have the same altitude. So in case of these screenshots where all tiles have the same altitude (as you say), no stretching is necessary.

In this case, the terrain tile is drawn exactly the same way as static tiles (i.e. the graphic from art.mul is placed at the appropriate coordinates completely unmodifed - pixel by pixel).