Game Development Community

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.
#41
11/17/2005 (10:05 am)
I think the 1800 is gonna be close to what X360 has under the hood...
If they offer it in AGP I would consider it.
#42
11/28/2005 (2:51 am)
The thing about curved relief mapping, I believe it requires storing an equation in each vertex which describes the theoretical curvature of the polygon, thus allowing one to warp texture space in the shader. This isn't really practical since it requires 1) completely recoding any part of the engine that deals with creating vertices (skybox, terrain, water etc.). Changing the .dts and .dif file format and rewriting all the exporters and 2) requiring that the artists re-export all the art in the new format. The cool thing about relief mapping is that it's a simple shader drop in. Doing curved relief mapping would require major engine modifications, which would really not be practical. If anyone knows anything about curved relief mapping contrary to what I've said, please feel free to correct me, as I could be wrong, I haven't studied the paper too closely yet.
#43
06/20/2006 (9:31 am)
Great work. That curved relief mapping is definitely going to change the face of gaming.
I imagine you could probably implement ANIMATED curved relief mapping as well for some incredible results. Would work great for anything from musculature to complete body morphing. I really hope there's a way to get it in TSE.

Edit: Looking closer at the paper on curved relief mapping it looks as though the relation between the geometry and the bounding box needs to stay consistent for the "curved" relief mapping method to work. So I don't think you can apply this to deforming characters. I would think that for non-deforming geometry you could store the per point data yourself and calculate in the shader. This would make props and environment geometry look great, at least.
#44
02/27/2007 (5:34 pm)
This is an old thread, but this seems relevant...

I am using Ray's parallax mapping shader and have noticed that when I shoot a projectile with a light attached, all the objects using the parallax material turn black.

I have been tracing through the code and the light information being passed to the shader doesn't appear to be different with the projectile light or without. I am continuing to dig into what is causing the problem, but I thought I would throw it out there to see if anyone had any suggestions.

Thanks
Todd
#45
02/27/2007 (6:36 pm)
These shaders were implemented before TSE/TGEA had lighting. I don't think anyone has ever updated htem to work with lighting. I took a stab at it one day but I never could get it working.

Is there some documentation anyplace that can give us some clues on how to get lighting working in our shaders? I was trying to figure it out from some of the other shaders (dynamic terrain lighting etc) but was unable to.
#46
02/27/2007 (6:52 pm)
I really only know how to get sunlight working. I'm pretty sure the VC_light registers only take sunlight into account. I could be very wrong though.
#47
02/27/2007 (7:24 pm)
Hi guys,

Thanks for posting here.

I have a partial solution. The problem I was having was two-fold.

First, in the custom matrial definition I was doing the following:

texture[2] = $lightmap;

when it should have been this:

texture[2] = "$lightmap";

The impact of this is that the correct $lightmap texture was never actually being set. As a result, the shader was not getting a lightmap and, interestingly, it was working. Once I fixed this problem in the material definition, all of my parallaxed objects were always rendering as black. So, clearly the $lightmap texture is the problem.

I haven't delved fully into the lighting code, so I can only give a partial solution. What I did was I disabled the use of the lightmap texture in the parallax shader and I don' t set it in the material definition. Once this is done the shader works fine using the sunlight as the light. This is obviously only a partial solution because now the shader does not take into account lightmaps.

Thanks
Todd
#48
05/25/2007 (5:03 am)
Im confused on where to put the new code.

For this stuff:

new ShaderData( ReliefShader )
{
DXVertexShaderFile = "shaders/reliefV.hlsl";
DXPixelShaderFile = "shaders/reliefP.hlsl";
pixVersion = 3.0;
};

new ShaderData( ParallaxShader )
{
DXVertexShaderFile = "shaders/parallaxV.hlsl";
DXPixelShaderFile = "shaders/parallaxP.hlsl";
pixVersion = 2.0;
};

Do I put this in client/scripts/shaders.cs?

And where do I put the custom material data? Im not sure exactly how to map this to an object. Can anyone help me out?
#49
05/28/2007 (8:40 am)
Has the Parallax & Relief shaders been updated for TGEA 1.01 + ??

Regards,
#50
05/28/2007 (11:23 am)
They haven't been updated to work with the new lighting system, as information there is a bit hazy. However, they do still work.
#51
05/28/2007 (7:24 pm)
It is a shame that lighting has been in TGEA now for close to a year, and we still have no documentation anyplace on how to access it in our shaders.
#52
05/28/2007 (8:21 pm)
Well, that's not exactly true. If you look at the procedural shaders there are some examples there. The problem is I have no idea what to do for the dlightMap and dlightMask samplers they use. Look at procedural shaders P008 for one example. There are quite a few examples there, we just need to know what textures the procedural shaders use for lighting.
#53
05/28/2007 (10:07 pm)
Cue: John Kabus response here.
#54
05/29/2007 (12:17 am)
Cue: well erm... me :)

Right, relief mapping doesn't seem to want to work at all, when I apply it to a material the whole item disappears ingame.

Parallax works fine, all you have to do is comment out "texture[2] = "$lightmap";" on your material file and the lighting issue seems to resolve its self? (or atleast it comes up bright enough to see, whether its casting correctly im not sure).

Regards,
#55
05/29/2007 (1:26 am)
On the old shaders, Parallax displays fine, sunlight works on it. If you add a dynamic light next to it though you won't see it cast light.

Regarding the procedural shaders. I looked at them trying to figure out how to implement lighting into shaders a while back. But nothing I attempted worked, and without any documentation on them, I couldn't figure it out. To date it doesn't appear that anyone else has either, or if they have they have kept silent about it.
#56
05/31/2007 (8:00 pm)
Thanks Ray, I have been playing with the Parallax Shader.
here is a screen shot...





img529.imageshack.us/img529/1851/starterfpsbmap1ht4.jpg
#57
05/31/2007 (10:21 pm)
Is that using an embedded heightmap? It's kind of hard to tell from the screenshot. Unfortunately, the parallax effect requires and embedded heightmap the way the shader is currently written.
#58
05/31/2007 (10:22 pm)
Oh man... I gotta get this going in our game now.
#59
06/01/2007 (6:06 pm)
@Matt, if you play with the Alpha channel you can make it pop out more.

@Mark, if you need help with normal maps with Alpha channels in dds, I can help.

The Orc is next....
#60
06/01/2007 (7:14 pm)
Parallax mapping is mostly intended for flat surfaces, so the orc won't work very well. Still, it's worth a shot.