TSE Relief Mapping?
by Tim Betts · in Torque Game Engine Advanced · 11/02/2005 (10:37 am) · 156 replies
Hey shader junkies, so, we've had bump maps, normal maps, then parallax mapping, so what about the next challenge - relief mapping ? anyone even attempted to get this puppy working on TSE? Now I'm no shader programmer unfortunately, but it would look like that this approach (http://fabio.policarpo.nom.br/relief/index.htm) will yield far more accurate mapping than parallax mapping. Very exciting work. Any guru's willing to step up :) ?
Cheers -- Tim.
Cheers -- Tim.
#82
But for noodles I commented out texture[2] ="$Lightmap";
06/06/2007 (1:54 pm)
Use Noodle, I think they are the same but I never managed to get TDN one to work. But for noodles I commented out texture[2] ="$Lightmap";
#83
06/06/2007 (2:02 pm)
The shaders were ported from the free shaders that nVidia has in their SDK. The reason why I did all three, is because the shader nVidia supplied also included all three shaders. In addition you can setup the engine to use all three shaders, for the purpose of providing fallbacks, if relief mapping fails. It's also nice to have as many shaders as possible in the pack, so that people can examine the shaders and maybe learn how TGEA handles shaders. Normal mapping is pretty simple, so it's a nice simple shader for people to learn from. I would fix the relief mapping shader, and add support for the new lighting system, but I don't have a machine that supports shader 3.0 or greater. I kind of want to get a new Thinkpad 61T with DirectX 10 support, but funds aren't allowing for that at the moment. ;)
#84
and on a side note I'm having an issue and I was wonder if you guys could shed some light on it for me.
www.garagegames.com/mg/forums/result.thread.php?qt=63082
thanx,
James Brad Barnette
06/06/2007 (2:41 pm)
Cool ok, if I give you a video card an you fix it an help matt get the super shaders working?and on a side note I'm having an issue and I was wonder if you guys could shed some light on it for me.
www.garagegames.com/mg/forums/result.thread.php?qt=63082
thanx,
James Brad Barnette
#85
What do you think?
06/06/2007 (7:28 pm)
I have been playing with the normal map creation, and came up with this.What do you think?
#86
06/07/2007 (9:24 am)
Though the right idea is there, it looks too organic. Edge the blocks out a bit and smooth out the the white areas next to the black.
#87
06/07/2007 (1:42 pm)
Wow that has more depth than any normal mapping I have ever seen.
#88
06/07/2007 (4:05 pm)
These all look pretty cool, however when I compare them with the doom video I notice the Doom engine does the edge as pertuberances / protuberances (not sure of the spelling) and Torque does not. Is there a way to make the edges stick out and not be flat? Isn't it a GPU voxel process or something?
#89
Parallax mapping on the other hand works a lot like parallax scrolling. The basic idea behind how parallax mapping works, is based on the depth information, different parts of the diffuse texture will move different speeds based on the camera distance, when the camera movies. It's really a pretty simple technique, but it looks cool, and is quite effective.
06/07/2007 (5:42 pm)
That's parallax mapping not relief mapping. Relief mapping does not protrude, well not exactly as least. It will seem like there is geometry but geometry going into the texture. It really is just a hacky kind of ray tracing in realtime. And just to be slightly more insane, it does a second pass that does another hacky ray trace to actually self shadow the relief mapped geometry.Parallax mapping on the other hand works a lot like parallax scrolling. The basic idea behind how parallax mapping works, is based on the depth information, different parts of the diffuse texture will move different speeds based on the camera distance, when the camera movies. It's really a pretty simple technique, but it looks cool, and is quite effective.
#90
06/07/2007 (6:11 pm)
@ James, The only differance between Normal Maps, and Parallax Maps is that the Parallax Map has height information in the Alpha channel. Other than the Alpha channel they are both Normal Maps.
#91
In the case of the parallax shader, the alpha channel is used as a heightmap (since we just need a simple value between 0 and 255 to represent the height). What you have to consider is that is that if you really wanted to, you could create a whole new texture and use any of the color channels (R, G, B or A) as the height map. It's just a matter of tweaking the shader to use a different map for that specific part of the shader (which is extremely easy to do).
Actually with shader hardware everything works pretty much like that. For example you have vertices that are sent to your vertex shader. These vertices have one component that is required, the position. Every other component of the vertex is completely configurable and usable for any purpose (on modern hardware at least). The meaning and use of the vertex data is completely up to you. This allows you a great amount of flexibility on how you use the shader hardware.
When you boil it down, graphics cards are really just an advance, programmable vector processor (think MMX or SSE). They have been tailored to favor 3d graphics to a large extent, but ultimately I believe you will seen the used for more general purpose programming in the future. A good example of this is Cuda from nVidia (http://developer.nvidia.com/object/cuda.html).
06/07/2007 (6:39 pm)
Well if you want to be a bit more technical, it doesn't really matter how the images are setup. The key is the channels of the images themselves. A normal map is really just a map of vertex normals, showing which point is up, for each pixel of the texture. For example R could be x component of the vector, G the y component and B the z component. This gives the shader enough information to render the lighting for normal mapping. The ordering could have been different, and in fact each component could have existed on completely different textures.In the case of the parallax shader, the alpha channel is used as a heightmap (since we just need a simple value between 0 and 255 to represent the height). What you have to consider is that is that if you really wanted to, you could create a whole new texture and use any of the color channels (R, G, B or A) as the height map. It's just a matter of tweaking the shader to use a different map for that specific part of the shader (which is extremely easy to do).
Actually with shader hardware everything works pretty much like that. For example you have vertices that are sent to your vertex shader. These vertices have one component that is required, the position. Every other component of the vertex is completely configurable and usable for any purpose (on modern hardware at least). The meaning and use of the vertex data is completely up to you. This allows you a great amount of flexibility on how you use the shader hardware.
When you boil it down, graphics cards are really just an advance, programmable vector processor (think MMX or SSE). They have been tailored to favor 3d graphics to a large extent, but ultimately I believe you will seen the used for more general purpose programming in the future. A good example of this is Cuda from nVidia (http://developer.nvidia.com/object/cuda.html).
#92
But it does really matter how the images are setup.
06/07/2007 (8:16 pm)
Thank you for the details on this, my statement was from an noobe point of veiw.But it does really matter how the images are setup.
#93
06/08/2007 (12:28 pm)
With the current shaders yes, but it is extremely easy to change how they are setup in the shader code. Currently you just have to have the normal map on RGB and the height map in the alpha channel.
#94
06/12/2007 (7:49 am)
Ok is there support for an alpha mask in this shader? if so where do I put it?
#95
06/12/2007 (2:31 pm)
The Alpha Channel on a Parallax Map is already being used to contain the bump map information. What are you trying to mask?
#96
file1 : contains color texture plus an alpha channel for tranpaency mask.
file2 : contains normal map plus an alpha channel with heightmap
06/12/2007 (4:25 pm)
I need transparency have a panel that has some holes masked out. I have this for my textures:file1 : contains color texture plus an alpha channel for tranpaency mask.
file2 : contains normal map plus an alpha channel with heightmap
#97
06/13/2007 (10:22 am)
Oh, transparency for the Diffuse... it would be easy except this is a Custom Shader... good question.
#98
06/14/2007 (8:43 pm)
Hmm...the easiest way would probably be to change the actual shader. Getting simple translucency wouldn't require more than a few lines of code. However, translucent = true; works with custom materials I think.
#99
06/15/2007 (9:31 am)
Is that something that is done in the HLSL file or is it something that I can add to the materials.cs? and how do Itell it to use the alpha from that texture? or will it default that way?
#100
06/15/2007 (10:05 am)
Translucent = true; should be used in the custom material and I'm not entirely sure what that uses for translucency. In the actual HLSL pixel shader file you could probably do basic diffuse translucency.
Torque Owner James Brad Barnette
3Dmotif LLC
the only difference from what I can tell is how you implement them in the material.cs file. the one on the TDN seems to follow standard TGEA syntax when adding it where the noolness seems to have a completly different syntax. "At least in the pointers to texture files anyway.
see this is the shader call that you insert into the materials.cs for the one on the TDN:
new Material(BoxEdge) { mapTo = box_edge; baseTex[0] = "box_edge"; bumpTex[0] = "knot3bump"; shader = Parallax; version = 2.0; pixelSpecular[0] = true; specular[0] = "1.0 1.0 1.0 1.0"; specularPower[0] = 32.0; };and this is how you add the noolness parallax shader to you materials.cs file:
new CustomMaterial(myCustomMaterial) { texture[0] = "~/data/relief/rockbumpd.png"; texture[1] = "~/data/relief/rockbumpn.dds"; texture[2] = "$lightmap"; shader = ParallaxShader; mapTo = "textureToMapTo"; pixVersion = 2.0; specular = "0.75 0.75 0.75"; specularPower = 128.0; };as you can see the texture pointers syntax is completly different.
other than that is there anyone that has tried both implementations and can comment on their performance/quality differences?
the reason I ask is I was thinking I woudl alter the noolness shader so that it follows standard torque syntax.
Oh yeah, normal mapping is already in the engine so what is the point of the normal mapping shader in the noolness shader pack?