Notifications
Clear all

[Closed] Mini-Challenge #2 revisited

thought I would resurrect this thread as the copy normals to map channel technique has an off shoot that may be useful to someone.

It comes from blending normals of one object to another, say for arguments sake a tree trunk to terrain.

Now to do this you could use any of the ray casting functions available in mxs and project from the the trunk object into the terrain retrieve the normals and copy them to the trunk. The problem with this technique is though the normals are close they are never quite right. Even with Barycentric coordinate look up there are always errors, and therefore seams.

Now here's the trick if you copy the terrain normals to a map channel using the function Denis kindly posted or your own. Then use the projection techniques to copy the mapping channel data from the terrain to the trunk using Barycentric coordinate look up then convert the mapping channel back to normals on the trunk you'll get a perfect seamless blend (you can set the trunk normals directly from the terrain map channel as well).

an example

[img] http://img7.imageshack.us/img7/4545/blending.jpg [/img]

it’s uncanny

without

3 Replies

to make the result more clear you can post some image before blending… the hard seam has to be noticeable.
i like the idea to use rendering to smooth normals.

oops… you already did it

slight addendum, if it’s really time work then going via map channels is nigh on perfect , max rendering then using something like

rnormals = meshop.getFaceRNormals objmesh face
n  = bary.x * rnormals[1] +  bary.y * rnormals[2] +  bary.z * rnormals[3];
n = normalize n;

gives marginally better results.

Yeah, that’s a cool idea. I wonder if anyone else has done this for games? Seems like it would work for some meshes like custom rocks/terrain, but for instanced trees and such, it would not?

Unless they are all on the same/similar type of terrain slope,ect.