Texture baking from geometry nodes

Hello, community!

I’m making a terrain in geometry nodes to then bake as a height map. I’ve seen I can do the baking once I’ve applied the geometry nodes modifier, but when trying to do it without applying the modifier (so that the workflow is non-destructive) it won’t bake anything. Is there a way to do this? Everything is done procedurally, I first create a grid and save its UVs as a 2D vector face corner attribute, then I set the height of the vertices and finally I save those values as a float vertex attribute that I use in the shader editor. Once here I do the regular baking process, connecting directly the height attribute to the surface output, selecting an image node with the new image to bake to in it and its colour space set to non-colour, and setting the bake type to emit.

Thanks!

Try this:

That’s not a viable solution, the height maps I’m working with need to be mathematically precise and that method guesses and tweaks values a lot.

You can try to do this with the Gradient Texture in Shader Editor and then bake it.
Notes:

  • You should use Generated texture coordinates because it uses a bounding box of an object.
  • You must have high poly mesh to get good quality texture.

Here is an example:

My height maps are significantly more complex than that, and some of their features simply cannot be done with shaders. I’ve been thinking about rendering a top-down orthographic view of the plane emitting its height, inspired by the video you posted, but I don’t know if that will be as precise as baking the texture.

Can you, please, share the .blend file or, at least, a picture of your terrain?

If you thinking that rendering a top-down view is possible in your situation, then I don’t quite get why last method won’t work. It is basically what you are talking about, except your are baking map instead of rendering from camera.

1 Like