Baking textures maps from renders

Started by PabloMack, April 18, 2010, 10:52:42 AM

Previous topic - Next topic

PabloMack

Hi All,

Is it possible to take a colour map used in a global planet terrain texture and bake the plant populations into that texture?  What I would end up with is just another texture to colour the planet's entire surface with.  The purpose is to avoid having to paint them in like you would a matte. 

TheBlackHole

Just populate everything over the planet's surface. I can make a mask if you want.
They just issued a tornado warning and said to stay away from windows. Does that mean I can't use my computer?

PabloMack

#2
Quote from: TheBlackHole on April 18, 2010, 05:58:50 PM
Just populate everything over the planet's surface. I can make a mask if you want.

So is this "mask" the 2D baked image that can then be wrapped around the surface of the planet containing both the flat images of the vegetation plus the terrain that was visible where there was no vegetation?  I don't understand how this is produced. 

TheBlackHole

It tells Terragen where to put the 3D plant/tree objects. Use it in an image map shader, then set it as a density shader for the population, and check "Invert density shader".
They just issued a tornado warning and said to stay away from windows. Does that mean I can't use my computer?

Dune

If I understand your query right, that would be an enormous image map! Global plant distribution?

PabloMack

#5
Quote from: TheBlackHole on April 18, 2010, 10:52:35 PM
It tells Terragen where to put the 3D plant/tree objects. Use it in an image map shader, then set it as a density shader for the population, and check "Invert density shader".

So how do you "bake" the image onto an under-lying 2D texture image?  I know there are perspective cameras and isometric cameras but you would need something like a satellite orbital camera to do this kind of baking.  You could try to do it with a rectangular planar terrain and an isometric camera but when you went to wrap it around a sphere the top and bottom would be pinched to the poles and the edges would not be seemless resulting in mountains being sliced into adjacent plains for example.  It needs to be done natively on a sphere (without a sun and only globally diffuse even lighting) because TG2 automatically makes the terrain seemless on a sphere and eliminates distortion due to latitudinal narrowing toward the poles.  But how to bake the image of the wrapped image back to the original 2D terrain texture requires some sophisticated back-calculation.  

PabloMack

#6
Quote from: Dune on April 19, 2010, 02:43:00 AM
If I understand your query right, that would be an enormous image map! Global plant distribution?

I only need enough resolution in the baked image for an orbital global view of the planet.  This will basically pre-render an image that is essentially flat (i.e. no thickness, but curved when wrapped around a sphere) for distant views for speed of rendering animations.  However, as the space craft descents to its target area, I will use progressively higher resolution regional maps as the craft gets closer to the surface and, finally, at only a few thousand feet on down I will use actual 3D populations which should only need somewhat local geometry.  

So it is not an enormous image but it is, potentially, an enormous terrain/population geometry to start with.  To lower the complexity, I might use giant plants in the vast areas that will not be seen in close proximity to get the colour progression right.  If I can use masks to control plant size and density (and even better, if these can be controlled by distance from the camera), then I should be able to do it.  Where the craft descents, though, the plants will have to be smaller, more numerous and will have to converge to life size by the time I am using actual geometry for the renders.  But this means I only need to render a relatively low resolution global still once.  I will only need a diffuse global lighting for this as the final rendering will add the ambient lighting such as the sun, cloud shadows etc.  Of course, I will need to add atmospheric/water effects on top of this.  

If TG2 can't do this then there might be a plug-in that does.  If this isn't even available it might mean I will want to write one once the SDK comes out.  If the SDK allows the plugin to control the position of the camera and can get TG2 to render a specified pixel in that camera, then it can be done but it might require a tremendous amount of computation.  This really needs to use procedural/fractal instantiation during the render because instantiating individual plant models onto a planet the size of the Earth is just going to over-whelm todays computers and those into the forseeable future.  

My gut feeling says that TG2 is not setup to compute populations on-the-fly as needed using procedural/fractal techniques during render time because of that initial thing that happens at the beginning of a render with plant populations.  

Oshyan

What it sounds like you want to do is not currently possible. TG2 does not have any functionality for outputting texture maps or masks directly to exportable formats. The only way to do this is manually, using a customized render (e.g. orthographic, high altitude, square, with 0 atmosphere and neutral lighting for base texture).

We do plan to have more options for data export in the future. If this is not something we end up supporting directly, a plugin ought to be able to handle it. But we don't have a release date for the SDK at this point.

- Oshyan

TheBlackHole

The plant mask I'm talking about is made in Adobe Photoshop from Blue Marble data. I simply selected everything green and made it white, then selected everything else and made it black. It'll tell Terragen where not to put the plant/tree objects; they will, however still be 3D, not flat painted-on overhead views. IMO 3D is better for photorealism than 2D.
They just issued a tornado warning and said to stay away from windows. Does that mean I can't use my computer?

Matt

#9
You could prerender an image of your planet (preferably to a square image), and then reproject that rendered image through a copy of the same camera. You wouldn't need spherical projections, wrapping or unwrapping. The Image Map Shader can use any camera as a projection camera. If you render to a square image then you avoid some awkward numbers in the Image Map Shader and can just use its default values for size and position.

Matt
Just because milk is white doesn't mean that clouds are made of milk.

PabloMack

#10
I have been thinking about your post for a while (and thus no reply until now) .  Will the square (or rectangular) terrain you are talking about tile seamlessly longitudinally and converge to points latitudinally at the poles?  Otherwise, at the seams there will be mountains that abruptly end into valleys etc.  Also, the terrain must converge to a point at the poles, otherwise you will have a similar problem.  The advantage to using a whole sphere is that terragen will handle (I believe) wrapping of terrains around a planet seamlessly.  My goal is to produce a whole planet that I can use at the surface in areas that I give special high resolution.  If I only needed to deal with a section of flat terrain, I am pretty sure it would be pretty straightforwarrd to accomplish with an orthographic camera.  Perhaps I don't fully understand your explanation.  

Matt

They will not tile, nor do you want them to. Render an image of your planet from some viewpoint (say "Camera 1"), save that image. Now that image can be reprojected back onto the surface of the planet for subsequent renders, by projecting the image from Camera 1. If it is projected using the same camera that it was originally rendered from, then geometrically speaking it will give you a correct approximation of the original scene. Of course this will only cover parts of the scene that were visible in the original render, but you can choose a set of projections that combine to cover every part of the planet you're interested in.

If your goal is simply to bake renders of plant populations into a texture to apply directly back onto the surface of the planet for rerendering in Terragen, the above method is the best way. If you choose projection cameras that are actual views you want to render, you concentrate resolution exactly where you want it, and avoid all those problem associated with spherical mappings.

Matt
Just because milk is white doesn't mean that clouds are made of milk.