#1 2016-11-06 03:06:50


Displace direction ?

Hi There, another wierd FX-oriented question smile

Is it possible to displace a mesh using another direction than the normals ( eg : vertex color channels) ?

It's pretty useful for some FX tasks, like adding displace on the edges of a destruction sim :

Using a tweaked normal channel ( coplanar faces => same direction) it helps to keep complementarity between the frags.

Thanks smile


seems to work, creating a displace node at root level and tweaking it (using a constant vector, but should work with color set) :

Maybe using the computeNormals node is not the best thing to do ?

Last edited by paul.parneix (2016-11-06 05:49:59)

FX TD / Artist - 3D and Surface Scan Speciaist.



#2 2016-11-06 10:37:42

Guerilla dev, the guy to hug

Re: Displace direction ?

Sure sure, have a look at the VectorDisplacement shader.
It uses a delta vector and moves the vertices in tangent space smile
Unless you have the final normals somewhere, use calculatenormal (P) to evaluate the normals based on derivatives. This is usually the easiest way to do it ...

EDIT: the calculatenormal function uses P derivatives, so if your P value has very high frequencies, you might get strong noise/inaccuracies in the resulting normal. Most of the time, this is still good enough, but in case you're not satisfied with it, you can consider exporting a displacement vector map AND a normal map. You'll get the exact result there. Just make sure to use Displacement Mode = Displacement+Bump, so the displaced P and N are evaluated independently (N is then no longer dependent on P, and doesn't get polluted by noise.) 


Benjamin 'Ben' Legros
Guerilla developer



Board footer

Powered by PunBB
© Copyright 2002–2008 PunBB