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.
#62
06/04/2007 (2:23 pm)
Does it have to be DDS format? PNG's should work, shouldn't they?
#63
06/04/2007 (3:31 pm)
PNG files will work fine.
#64
the in the cube shader in the demo I replaced this
with this:
I have the maps in the right fiolder as specified.
yet when I get the to the cube int he demo I see the faces of the cube and they have their animated shader but the relief shader is not showing on the box edges as it should I see nothing at all there instead.

Any Ideas?
06/04/2007 (9:09 pm)
Ok I placed the shader in the the shader directory and then I added the following to the shaders.cs file://-------------------------------------------------------
// Relief Mapping
//-------------------------------------------------------
new ShaderData( ReliefShader )
{
DXVertexShaderFile = "shaders/reliefV.hlsl";
DXPixelShaderFile = "shaders/reliefP.hlsl";
pixVersion = 3.0;
};
//-------------------------------------------------------
// Parallax Mapping
//-------------------------------------------------------
new ShaderData( ParallaxShader )
{
DXVertexShaderFile = "shaders/parallaxV.hlsl";
DXPixelShaderFile = "shaders/parallaxP.hlsl";
pixVersion = 2.0;
};
//-------------------------------------------------------
// Normal Mapping
//-------------------------------------------------------
new ShaderData(NormalShader)
{
DXVertexShaderFile = "shaders/normalV.hlsl";
DXPixelShaderFile = "shaders/normalP.hlsl";
pixVersion = 2.0;
};the in the cube shader in the demo I replaced this
new Material(BoxEdge)
{
mapTo = box_edge;
baseTex[0] = "box_edge";
bumpTex[0] = "knot3bump";
pixelSpecular[0] = true;
specular[0] = "1.0 1.0 1.0 1.0";
specularPower[0] = 32.0;
};with this:
new Material(BoxEdge)
{
texture[0] = "~/data/relief/rockbumpd.png";
texture[1] = "~/data/relief/rockbumpn.dds";
texture[2] = "$lightmap";
shader = ReliefShader;
mapTo = "box_edge";
pixVersion = 3.0;
specular = "0.75 0.75 0.75";
specularPower = 128.0;
};I have the maps in the right fiolder as specified.
yet when I get the to the cube int he demo I see the faces of the cube and they have their animated shader but the relief shader is not showing on the box edges as it should I see nothing at all there instead.

Any Ideas?
#65
06/04/2007 (10:11 pm)
You can't just swap materials like that. Remember that the DTS is still using the textures applied in the modeling program. Rename rockbumpd with a texture actually used on that mesh.
#66
Regards,
06/04/2007 (11:54 pm)
The above material is mapped to the surface name so its working fine - and in the above picture relief has been applied, but as the shader doesn't work with TGEA 1.01 thats the effect you get.Regards,
#67
06/04/2007 (11:58 pm)
Oh wait. Your problem, you put material instead of custom material.
#68
new CustomMaterial(myCustomMaterial)
{
texture[0] = "~/data/relief/rockbumpd.png";
texture[1] = "~/data/relief/rockbumpn.dds";
texture[2] = "$lightmap";
shader = ReliefShader;
mapTo = "textureToMapTo";
pixVersion = 3.0;
specular = "0.75 0.75 0.75";
specularPower = 128.0;
};
---
But the shader is not working and you will still get the above results :)
06/05/2007 (12:03 am)
Going of the readme it should look something like:new CustomMaterial(myCustomMaterial)
{
texture[0] = "~/data/relief/rockbumpd.png";
texture[1] = "~/data/relief/rockbumpn.dds";
texture[2] = "$lightmap";
shader = ReliefShader;
mapTo = "textureToMapTo";
pixVersion = 3.0;
specular = "0.75 0.75 0.75";
specularPower = 128.0;
};
---
But the shader is not working and you will still get the above results :)
#69
06/05/2007 (12:37 am)
The shader compiles fine. What are you referring to?
#70
Matt: could you post a screenshot if you do have it ingame with 1.01?
06/05/2007 (6:49 am)
Shader doesn't currently work ingame since the update to the lighting? Matt: could you post a screenshot if you do have it ingame with 1.01?
#71

06/05/2007 (8:15 am)
Certainly. The shader does work fine though, it's just not set up to work with alternate lighting sources found in TGEA 1.0+
#72
06/05/2007 (8:26 am)
Very strange, parallax seems to work fine this end, but Relief doesn't (ends up looking like James).
#73
Also, the problem with James is that this:
Should look like this:
06/05/2007 (8:36 am)
Do you and James both have shader model 3.0 video cards?Also, the problem with James is that this:
new Material(BoxEdge)
{
texture[0] = "~/data/relief/rockbumpd.png";
texture[1] = "~/data/relief/rockbumpn.dds";
texture[2] = "$lightmap";
shader = ReliefShader;
mapTo = "box_edge";
pixVersion = 3.0;
specular = "0.75 0.75 0.75";
specularPower = 128.0;
};Should look like this:
new CustomMaterial(BoxEdge)
{
texture[0] = "~/data/relief/rockbumpd.png";
texture[1] = "~/data/relief/rockbumpn.dds";
texture[2] = "$lightmap";
shader = ReliefShader;
mapTo = "box_edge";
pixVersion = 3.0;
specular = "0.75 0.75 0.75";
specularPower = 128.0;
};
#74
06/05/2007 (1:38 pm)
My fault, its because my x800 card doesn't support px 3.0 :(I assumed it had) - only problem is the fallback doesn't appear to work, still tries to use the relief rather than dropping back to parallax.
#75
all have 3.0 support I will try changing that code and see how it goes.
Also I notice that the heightmaps seem to be opposite of the normal white being the highest point and black being the lowest point.
first is there a reason for this? and second can it be changed?
06/06/2007 (7:35 am)
Yeah I have 2 systems with Quadro FX 3450s and one that is a GF 7900GTall have 3.0 support I will try changing that code and see how it goes.
Also I notice that the heightmaps seem to be opposite of the normal white being the highest point and black being the lowest point.
first is there a reason for this? and second can it be changed?
#76
Mine disappears like the above picture, and though fallback is also set doesn't appear to work.
new CustomMaterial(stone01_3)
{
texture[0] = "stone01";
texture[1] = "stone01_normal.dds";
texture[2] = "$lightmap";
shader = ReliefShader;
mapTo = "stone01";
pixVersion = 3.0;
fallback = stone01_2;
specular = "0.75 0.75 0.75";
specularPower = 128.0;
};
06/06/2007 (8:00 am)
Yes the height maps are opposite for these shaders, it should still work either way. Mine disappears like the above picture, and though fallback is also set doesn't appear to work.
new CustomMaterial(stone01_3)
{
texture[0] = "stone01";
texture[1] = "stone01_normal.dds";
texture[2] = "$lightmap";
shader = ReliefShader;
mapTo = "stone01";
pixVersion = 3.0;
fallback = stone01_2;
specular = "0.75 0.75 0.75";
specularPower = 128.0;
};
#77
06/06/2007 (11:18 am)
So does this work in 1.0 or doesn't it? I'm confused now. I'm running 1.01
#78
James: - I don't thing so, use Parallax for now, it uses the same height data etc so Relief (when it does work) should be fine.
06/06/2007 (11:22 am)
Going of your screenshots Matt your running the shader on MS4? not 1.01? James: - I don't thing so, use Parallax for now, it uses the same height data etc so Relief (when it does work) should be fine.
#79
06/06/2007 (11:38 am)
I'm using stock TGEA 1.01. It works fine, you're just not mapping it correctly.
#80
I got it working in 1.0.1. The lighting does seem to be a bit off especially back in the corners
06/06/2007 (11:59 am)
They why does it say MS4?I got it working in 1.0.1. The lighting does seem to be a bit off especially back in the corners
Torque Owner John Adams