Forum

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

paul.parneix
Member

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 :

http://img4.hostingpics.net/pics/406014houdinidetails.jpg

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

Thanks smile


EDIT :

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

http://img4.hostingpics.net/pics/742287normalguerilla.jpg

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.

Offline

 

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

Ben
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.) 

Ben


Benjamin 'Ben' Legros
Guerilla developer
http://www.guerillarender.com

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2008 PunBB