Grid lines and floor files

For developmental things relating to the graphics of the game.
User avatar
n54
MVP
Posts: 1587
Joined: Sun Dec 21, 2003 12:40 pm

Grid lines and floor files

Post by n54 »

this isn't important but i'm just wondering if there is a setting to enforce the grid lines to not loose focus over distance? or is it just my gfx card? i have something similar with any wall textures but it seems much less pronounced...

also because of recent meddeling with floor.png, floor_a.png and floor_b.png in the moviepack i'm wondering if this is true:
- floor.png is used when using a texturized floor
- the two others are used with the "just grid" option

& thanx for fixing the moviepack floor color bug, it works perfectly now :D
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Post by Jonathan »

just grid = draw some lines
single texture = floor.png
dual texture = floor_b.png added to floor_a.png in two rendering passes (looks best but is slowest)
ˌɑrməˈɡɛˌtrɑn
User avatar
Z-Man
God & Project Admin
Posts: 11717
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Post by Z-Man »

Jonathan wrote:dual texture = floor_b.png added to floor_a.png in two rendering passes (looks best but is slowest)
This is the texture sharpening option n54 is missing. The loss of focus of the gridlines is caused by the flat angle the grid is viewed under. With generic textures, the "Anisotropic Filtering" feature of modern graphic cards helps prevent this, with some special textures like the grid, you can fake it.
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Post by Jonathan »

Why would it be missing? A quick search for the dual floor constant in all source files didn't reveal anything.
ˌɑrməˈɡɛˌtrɑn
User avatar
Z-Man
God & Project Admin
Posts: 11717
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Post by Z-Man »

Jonathan wrote:Why would it be missing? A quick search for the dual floor constant in all source files didn't reveal anything.
It's not really missing, but n54 has not found it yet.
User avatar
SuPeRTaRD
Round Winner
Posts: 300
Joined: Fri Nov 05, 2004 11:53 pm
Location: bedlam
Contact:

Post by SuPeRTaRD »

my custom wall .png is way clearer & easier to see from much further away in the moviepack

dunno why
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Post by Jonathan »

@z: ah.
SuPeRTaRD wrote:from much further away
You get blurriness when the texels/pixel ratio is different for each dimension and at least one >0 mipmap and one <highest mipmap are used. So distance is the perfect case for mipmaps and doesn't make textures blurrier. Flat angles are what usually makes textures blurry.
ˌɑrməˈɡɛˌtrɑn
User avatar
n54
MVP
Posts: 1587
Joined: Sun Dec 21, 2003 12:40 pm

Post by n54 »

z-man wrote:
Jonathan wrote:Why would it be missing? A quick search for the dual floor constant in all source files didn't reveal anything.
It's not really missing, but n54 has not found it yet.
well it used to work like that but for a long while all i got if i turned dual texturing on for the floor was a solid colored floor. this was caused by me misunderstanding how the a and b textures were used. i've changed them and now it works as intended. thanks for the help both :)

next question: does the a/b textures need to have the proportions of 1x256/256x1? it seems so to me as i couldn't find any rendering difference from making the floor_a.png texture have the proportion 20x256. am i right or wrong?
User avatar
n54
MVP
Posts: 1587
Joined: Sun Dec 21, 2003 12:40 pm

Post by n54 »

SuPeRTaRD wrote:my custom wall .png is way clearer & easier to see from much further away in the moviepack

dunno why
This could be because of the texture resolution of the files themselves: if you use a (somewhat low but default) resolution by using a texture file of 256x256 it will look sharper far away as when you are close to the texture you'll see the individual pixels magnified and blurred.

The solution is to make the texture files themselves larger, try 512x512 and you'll see a difference, try 1024x1024 as the size of the texture itself (used to be the maximum texture size for walls, probably still is) and you'll almost not notice any blurring at all /depending a bit on what the texture depicts. I have not noticed any drop in fps on my machine using 1024x1024 pixel png files for the textures.
User avatar
Z-Man
God & Project Admin
Posts: 11717
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Post by Z-Man »

n54 wrote:next question: does the a/b textures need to have the proportions of 1x256/256x1? it seems so to me as i couldn't find any rendering difference from making the floor_a.png texture have the proportion 20x256. am i right or wrong?
There should be a small difference, but it won't be visible with the naked eye. The textures are stretched very far in the direction they have only one pixel width in so the pixel proportions get "normal" when you look at the horizon parallel to the gridlines, making the texture larger will make the proportions a bit less normal.
If you want to make an effect by larger textures ( wiggled grid lines? ), sure go ahead. But they will be stretched quite a lot.
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Post by Jonathan »

Now we're talking about the dual texture floor:
- Why did you make the lines in one dimension brighter than in the other? (I know why it happens, but why did you do it?)
- How about multitexturing the floor? (as an option) What are we going to do with the alpha channel?
ˌɑrməˈɡɛˌtrɑn
User avatar
n54
MVP
Posts: 1587
Joined: Sun Dec 21, 2003 12:40 pm

Post by n54 »

Ah I think this explained a lot of questions I logged in to ask right now lol

The way it is it's two transparent layers on top of each other, something which makes getting exact colors/color tones a kind of nightmare :?

Would there be any technical difficulties in changing the code so that it scales up from a 256x256 texture instead (max in one direction and according to "grid settings #=256" in the other)? I'm thinking if one did that and used transparent areas in those one could get the sharpness as well as real colours (what you see in the texture is what you see on the grid)? The way it is now what ever color you use for the grid line will me washed out 50% by the grid tiles and vice versa...

Maybe that isn't the solution, anyone have any ideas of how one could get both sharpness as well as retaining true colors? It would also be nice with a solution that doesn't remove the possiblity of anything but grid lines if one wants sharpness.

Maybe a way to do this would be to only draw the gridline textures at certain intervals and to only stretch them in their lenght direction (the texture files would then be all one colour). If one in addition do this on top of the floor.png texture one would possibly get both sharpness and detailed textures (if done in this fashion the floor.png texture should not include any grid lines).

Hmm that doesn't seem ideal either... on second thought I think my first suggestion would be the real problemsolver *wonders if anyone understands what I'm discussing* :oops:

Anyway if anyone else is struggeling with this stuff I recommend setting
moviepack_floor_red .4
moviepack_floor_green .4
moviepack_floor_blue .4
in the settings.cfg in the moviepack folder, it's not 100% correct (it can never be) so try around for whatever grid colors you are using.
User avatar
n54
MVP
Posts: 1587
Joined: Sun Dec 21, 2003 12:40 pm

Post by n54 »

Jonathan wrote:Now we're talking about the dual texture floor:
- Why did you make the lines in one dimension brighter than in the other? (I know why it happens, but why did you do it?)
- How about multitexturing the floor? (as an option) What are we going to do with the alpha channel?
I'm pretty sure you're asking Z-man and not me, and perhaps you are talking about the (first) moviepack? Z-man didn't make that afaik and the reason for the difference in brightness is that the person just clipped the floor.png texture when making floor_a/b.png and since there is a brighness difference in the lines of floor.png.... well there you go :D

I say let's use the alpha channel for transparency as suggested in my first (and final :P) solution on floor textures in my previous post.
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Post by Jonathan »

Currently the alpha channels are treated this way: first draw floor_a using the usual alpha blending, then add floor_b after multiplying by its alpha channel.

Edit: Impossible using multitexturing because it's independent of the framebuffer, but that's an advantage.

Especially the default non-moviepack textures (!) are brighter in one dimension.

You can use anisotropic filtering to prevent most blurriness.
ˌɑrməˈɡɛˌtrɑn
User avatar
Z-Man
God & Project Admin
Posts: 11717
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Post by Z-Man »

Jonathan wrote:Now we're talking about the dual texture floor:
- Why did you make the lines in one dimension brighter than in the other? (I know why it happens, but why did you do it?)
As n54 said, I did not make the textures myself. In the non-moviepack version, the gridlines have the same intensity ( I hope ).
- How about multitexturing the floor? (as an option) What are we going to do with the alpha channel?
You mean the multitexturing extension of opengl? Yep. That's the way I'd do it today. Back when the code was written, multitexturing would not have given additional speed in most situations and I was too lazy to lear and use it.
n54 wrote: The way it is it's two transparent layers on top of each other, something which makes getting exact colors/color tones a kind of nightmare
Why? The two textures are just blended additively, and the color of the second texture gets multiplied by its alpha value. What could be simplier? I don't really know why its not using standard alpha blending, but changing the code would break compatibility now. I understand that now it's impossible to get black gridlines on bright background.

Anyway, for the cycle customization I'm currently thinking about a nice material system. One that would allow full customization of multilayered textures in its later versions. That will replace the custom hardcoded stuff done for floor&walls right now. I'll start a new topic about that sometime when the basics are ironed out to ask for design input.
Post Reply