PDA

View Full Version : Render to Texture: getting it to recognize alpha


moiremusic
08-15-2008, 05:23 PM
I'm attempting to render out a tree branch as a flat normal map using Render to Texture. The leaves on my branch are planes with textures that use alpha transparency to define their shape. My problem is that the exported normal map is still rendering the alpha areas. Is their anyway to get the renderer to honor the alpha and ignore these areas?

http://farm4.static.flickr.com/3213/2765884744_2ac2eacc15_o.jpg

Grim Beefer
08-15-2008, 11:54 PM
I'm a little confused as to what you are asking for. Are you trying to bake the normal maps of the leaves into their respective materials, get a UV map that you can edit externallly, or get a flat image of your scene from a certain perspective to emboss another piece of geometry with?

If you're trying to get a normal map for the geometry in scene, then you don't have to worry about the unclipped areas of the leaves as the opacity map should still cut away these spaces during a final render.

If you're asking for what I think you are (a "normal map" element render), then just bake the normal maps onto the geometry using the Render To Texture tool, render the scene with all materials at 100% self illumination and no lights, put the normal maps into the diffuse (not bump) slot of the materials, and change the enviroment color to the pale blue in your screenshot. Make sure that the opacity maps are still enabled and working. You'll get a flat render without the white space that is respective of the normal maps.

moiremusic
08-16-2008, 01:53 AM
If you're trying to get a normal map for the geometry in scene, then you don't have to worry about the unclipped areas of the leaves as the opacity map should still cut away these spaces during a final render.

Thanks, Grim Beefer. I guess I should have been more articulate, but you're getting my drift. I'm taking this branch geometry and projecting it onto a simple plane using Render to Texture in order to get a normal map that I can map to a simple plane in a game engine, along with a diffuse and specular map from the same branch geometry. Basically making a "billboard" that will be a substitute for hi-res geometry. The diffuse hasn't been a problem, just the normal map that you see here.

Using the alpha channel as an opacity map doesn't fix the problem, because, even though it gives me the silhouette I need, there are still bits of the unwanted "alpha areas" overlapping parts that I need to be able to see. You can see in my normal map that some of the unwanted white areas are covering the main trunk near the base. Those will remain there even after the opacity map is used to get the proper silhouette. And that will give some confusing lighting on the branch when lit in-engine.

So what I'm hoping to find is some configuration that will keep the alpha areas from rendering when creating the normal map.

moiremusic
08-16-2008, 02:03 AM
If you're asking for what I think you are (a "normal map" element render), then just bake the normal maps onto the geometry using the Render To Texture tool, render the scene with all materials at 100% self illumination and no lights, put the normal maps into the diffuse (not bump) slot of the materials, and change the enviroment color to the pale blue in your screenshot. Make sure that the opacity maps are still enabled and working. You'll get a flat render without the white space that is respective of the normal maps.
This is brilliant! Sorry, I had to read it twice before I really got it. It still doesn't fix the overlap problem the way you've described it, but if I render and bake the normal maps into the geometry of the leaves and branches separately, then re-combine the two objects in the scene and render them out together, everything should overlap perfectly. :)

moiremusic
08-18-2008, 06:59 PM
Hm, I tried it this morning with no luck. I assumed you meant I should take the normal map I created and apply it back to the geometry (first leaves, then branches) as a planar map in the diffuse channel, but then still the alpha area overlaps other leaves and I have the same problem.

Is there a way to apply the normal map directly back onto the leaf/branch geometry in Render to Texture?

mikebart
08-20-2008, 02:27 AM
I asked the same question quite a while ago, but it seems render to texture doesnt respect alphas like your normal scene render, only geometry.
It would be so handy if it could, not just for baking branches but for making all sorts of textures.

but if you find a way please pm me...:)

sethwolford
08-20-2008, 06:30 AM
there was a discussion on the polycount forums a while ago about this and the only solution I saw that worked was to use Ben Clowards method shown here.

http://www.bencloward.com/tutorials_normal_maps11.shtml

The other thing that has worked for me in the past is to place a gradient ramp in the diffuse slot rendered in orthographic view to create a height map and then take that into Photoshop to make your normal map.

here is the link to the polycount thread. It might explain a little better then what I have done.

http://boards.polycount.net/showthread.php?t=54438&highlight=alpha

CGTalk Moderation
08-20-2008, 06:30 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.