Jump to content
  • Advertisement
Sign in to follow this  
Wrongfire

Heightmap issue

This topic is 2587 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, I am new and I signed up for just one issue thats been bugging me for months.
It's the barrier between getting level of detail in this game, I need a heightmap of a 3d model.

However I just cannot figure out how to get a heightmap from the front and the back of this model.
I checked online for heightmap editors but they were for landscapes, and I am trying to get a heightmap of a 3d object from all (well just 2) sides.

I have 3ds max 2010, any help would be SOOOOOOOOOO appreciated. This stupid little issue that I never thought would come up has been holding the project back graphically :(

It needs to be according to the UV map. I don't know WHY this is so hard. I did render to texture, heightmap.. nothing... I did this gradient trick, but it doesn't work for both sides.
I just don't know what to do. Please help me!

The final product needs to be precise too, exactly fitting within the 1024 1024 uvmap.

Share this post


Link to post
Share on other sites
Advertisement

I just don't know what to do. Please help me!

Dito.
Could you be more concrete about what you're talking ? Maybe some screenshots ?

Here are some keywords you should goolge for:
- hi-res modelling
- texture baking (hi to low poly)
- displacement mapping
- sculpting
- zbrush
- normal mapping

Share this post


Link to post
Share on other sites
Yeah for sure.. I was almost going to make a video explaining it. (Ive looked all over google and youtube as well.. No one uses height maps like this I guess..?)

Okay so here's the deal, It's a space rpg game, we are rendering lod objects via a 3d box that uses a normal map and a heightmap to project objects that are far away.. I think?.. I don't know the technical side of it but the programmer says it looks way better then just 2d billboards. I need a heightmap, and I already have the normal map.

Screenshots:

Heightmapissue.png?t=1305950254

So that's the model, and the uv map for it.
What I need is for each of those sides represented in the map to show a heightmap from that angle.. If that makes sense.. So 2 height maps of the same model from 2 different angles, the ones in the uv map.

If I need to show anything more im more then willing too if it'll help you help me solve this!

Share this post


Link to post
Share on other sites
I suspect that to get exactly what you want, you are going to have to do some scripting. I use Blender, and I know that in Blender you can use the compositing Node system to output the depthmap of a scene pretty easily, but that's maybe not exactly what you want. In Blender you can also bake a displacement map from one object to another, but again that doesn't seem exactly like what you want.

One problem I can see with your approach (or maybe I just mis-understand what you mean) is the assumption that the UV-map "islands" (clusters of faces in the UV unwrapping) each correspond to a view of the object from a particular angle. It is possible, of course, since you can orient the object to a view and project faces when UV-unwrapping, but this isn't really the best way to UV-unwrap an object, since faces that are oblique to the view when projected get very little texture space in the final map regardless of their size, in the worse case even turning "degenerate" (ie, projecting to a line in the UV map, rather than a triangle/quad), which results in severe stretching or distortion when rendered. The best ways to UV-unwrap an object are to unwrap it so that faces get space in the texture map proportionate to their actual size; in this case, then, the projected islands will not correspond to any particular view orientation.

One way of doing what you want might be to write a script that projects a series of rays. The rays are projected as eye or camera rays, using the desired projection/perspective settings. When an intersection is calculated, the UV coordinates of a face are interpolated to find the texture coordinates, then the calculated depth value of the ray intersection is written into the texture map. While this wouldn't really be too difficult to implement as a script, I do not know of any "standard" means by which it can be done without scripting.

But if you are using mapped boxes for LOD primitives, do you really need the baked heightmap to correspond to the UV map?

Share this post


Link to post
Share on other sites
I'm waiting for the programmer to get back to me on your question, but I know that the normal map and the heightmap need to match up exactly.

Couldn't I cut the asteroid in half, and use only half the UV map, to do a normal height map technique on it? and then just do the other side separately?

I don't know anything about scripting in 3ds, so Id have a really hard time trying to do that.
But do you think that raycasting technique could create the heightmap and the uv map at the same time? It might work that way.

Share this post


Link to post
Share on other sites
Maybe I just don't understand exactly how your LOD scheme really works. Maybe a more detailed explanation? I know from your previous posts that it involves a heightmap and a normal map and a 3D box. Are the maps actually applied to the box, or are you guys instead using a sort of beefed up billboard system, where the maps are used to add the illusion of depth to the billboard plane? If this is the case, I wouldn't think your height/normal maps for the billboard would need to correlate to the UV mapping of the object, but again I can't really picture what you are doing.

You wouldn't use a raycast to build the UV map, the best solution for that is just grunt work with a 3D editor. The raycast would just populate a texture image with data. The UV mapping would need to be done already. I just sort of tossed that idea out there, but I have no idea if its even relevant.

Share this post


Link to post
Share on other sites
For space games often "depth sprites" are used. In fact these are simple billboards + a depth map + normal map . Using a deferred render you could use this depth sprite for much better light interaction.

In this case you can simply render the object to the camera and use 3 render passes: standard texture only pass, a depth map pass(maybe you need to use nodes as JTippetts mentioned it) and a normal map pass (object space?).

To get the billboard texture right use a RGBA target format and turn off the sky to get a proper alpha value for your rendered models.

Share this post


Link to post
Share on other sites
Hey, here's a quote of how the lod system is working.

"we take a view of the asteroid from one side, with each pixel recording its distance to the camera
and then a view from the other side, this gives us two heightmaps, The engine draws a cube, and uses a shader to raycast into the cube, and figure out if the ray from the camera through the cube is intersecting one of the heightmaps and where it's doing so from there. We then take a view from both sides again that record the texture coordinates as RG colors so we can index in and get the object's stuff from it's normal map (object-space, not tangent space), as well as its texture color"

The advantage to this method is that the lod asteroids can rotate and move freely in the distance, and it's only rendering 8 vertex's from the cube, and then the amount of pixels visible from the lod asteriod, which is around 30 or so each. depending on it's distance.

Share this post


Link to post
Share on other sites
[attachment=2416:depthnormal.png]


Is this roughly like what you need? On the left is a normal map baked to a plane, in the center is the asteroid, on the right is a depth map baked to a plane. Of course, the depth map would need some post-processing to invert the depth and move the outside regions to black, but that is easy to do in the Gimp or Photoshop.

To make this image, I sculpted a quick asteroid then used Blender's Bake menu to bake an object-space normal map to one plane, and a displacement map to another. You can also bake texture (color) information to a third image, ambient occlusion map to a fourth, and so on.

Share this post


Link to post
Share on other sites
Yes, that depth map is exactly right, just needs to be inverted! how did you do that? And is it possible to get the depth map of the back side of the asteroid with the same size and orientation?
Is blender easier for this stuff then 3ds?

Lastly, I guess it isn't important if the normal map lines up, the height map can be 2 separate images, one of the front, and one of the back, while the normal map uses the UV map, if that makes things easier.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!