DisplaceMap+Glass Shader Fog problem

Hello people,

i´m trying to use a displace map into the Dottore´s glass shader,
i made it but now the fog effect doesn´t work, maybe anybody knows how to make it posible? am i missing something?

thanks in advance.


Displace CubeMap_Fog problem (109.7 kB)

Any idea?.. no text …

i´ll try this solution

https://vvvv.org/sites/default/files/imagecache/large/images/Mesh_Landscape_15-DirectX Renderer_2010.12.06-12.55.22.png

https://vvvv.org/sites/default/files/imagecache/large/images/DisplaceCubeMap_Fog_Test_3-DirectX Renderer_2010.12.06-12.51.53.jpg

Hey people,
i made the fog effect inside the cubemap shader, but i´ve noticed that the normals are not correct calculated…

there are 2 examples, the first one is a mesh calculated in the cpu, and the second one is a shader with displacemap, fog and the cubemap with this error in the normals,

how can i calculate correctly the normals of the displacemap mesh to be used by the cubemap texture?

Any help would be very appreciated, i think this is a good shader for the vvvv library.


seconded, that looks like it would be a lovely shader to use.

I hope to have a solution soon, with the help of my vvvv friends ;)

hello lasal,

this is a known problem when changing vertex positions in a shader. if you alter one position you affect 6 faces, but since you have no access to the neighbours, you cannot update the normals at the other positions.

calculating the correct normals is possible when you have some kind of formula which alters your position. then you can calculate the neighbour positions yourselve and calculate the normals from scratch.

it might be possible in your shader, if you only use a grid as input. because then you can also calculate two neighbours with an offset in x and y direction and get the normals form them with some basic vector math…

Hello Tonfilm,

thanks a lot for the idea,
maybe is there an example of this vector math? or some shader example?

it seems it would be a little complicated when i use other kind of meshes, predesigned x-mesh, etc

maybe i have to looking for other solution.

Thanks again.

ai lasal, have you checked this heightmap-displacement? it does the normals calculation in the pixelshader…

Hello Joreg,
i´ve checked it, but i couldn´t implement the cube texture effect,
i have not experience in shader programming and for me it´s a very experimental process, i need more time than the programers ;)

thanks a lot, i´ll check it again with other mood.


hey lasal think the problem is in light calculation, i fixed it on displacement map shader that joreg pointed , will look on yours in few hours. Can you upload it here?

It would be sweet, thanks a lot ;)

for the moment i´m working with the cpu version of my patch, but it only supports a 40x40 grid :P

thanks again antokhio

displace cubemap_fog_test2 (106.6 kB)

Huge messy code from Nvidia, that would take some time to sort out ;]
I’m in deep hangover now, will sort that out, but it will take a day
or so don’t worry ;]

tryed to find you on skype, but looks like you are offline all the time ;]

Don´t worry about the time, and yes it´s a little bit messy hehe
Sorry i don´t use skype when i´m working :P
good luck with the code ;)

manged to do coupple of checks, and seems quite strange…
first of all i founded that fog don’t work on all the displace shaders, so i started to look at that deeper, founded that actuall source of evil is:

VertexShader = compile vs_3_0 VS();
PixelShader  = compile ps_3_0 PS();

as you change both to 2_0 & 2_0, fog is back, but tex2dlod won’t work.
looks like you already pointed on workaround will check it back t-mo
that fog thing quite strange

might be devvvs know something

it´s out of my limits.

Still don’t have time to finish your shader…
Here is compare patch to desax shader and update.
Might that can help…

Since it’s impossible to do fog on PS VS 3 your foginside version must work…
I hope next week will be little bit more free time… ;]

displace help.v4p compare patch

_Displacements.rar (95.8 kB)

Thanks a lot Antkhio, i´ll check it soon, in this moment i´m in tenerife and i have not internet connection… but it´s sunny ;)