3
$\begingroup$

I'm using Blender 3.5.1

What I Want To Achieve

I am creating a Procedural Planet Generator with Geometry Nodes.

For this purpose I prepared two materials - one for the surface (surface) & one for the atmosphere and clouds (volume).

In Geometry Nodes, I generate two spheres and apply the aforementioned materials to them. Each sphere receives its respective material.

Now I would like to drive the generation process entirely through Geometry Node Group Inputs, but most of the variables and colors that can be dialed and changed are located in the Shader Group Inputs.

No matter what I try, I simply cannot get float values from Geometry Nodes to the Shader.

What I Tried

  • I tried feeding in the geometry node Group Input values directly to the Group Output and then getting these values in the Shader via the Attribute node (I tried declaring the variable type as Geometry, Instance, etc.) but to no avail. (see picture)

One of the approaches to get the float attribute/field cloudDensity over to the Shader

  • Then I tried it by Store Named Attribute which I placed in Geometry Nodes before assigning the material. Then I tried it after setting the material and tried all different ways to store it inside the geometry (points, lines, splines, instance, etc.)

  • Then I tried to create the attribute in the Object Data Properties but still couldn't receive any values from within the Shader. I made sure that the attribute names are correct and identical.

Now I really ran out of options/ideas and overall patience. All I want is to get a simple float value (field? It seems all Geo Node outputs besides Geometry are fields, no matter what you do) from GeoNodes to Shader.

It cannot be that difficult, can it? All tutorials and related posts I found suggested the above way but none of them worked for me.

EDIT: Here is the Blend file: https://www.dropbox.com/s/5w491kfe7acgxou/Geometry%20Nodes.blend?dl=0

EDIT 2: I have tried all suggestions from here but it still won't work. I also tried Blender 3.3 but with the same outcome. It appears as if the Attribute never receives the value from Geometry Node. Its output always equals 0 (NaN).

SOLUTION: Gordons suggestion solved the problem. The solution works as long as I do not plugin the Realize Istance after the Instance of points node.

$\endgroup$
2
  • $\begingroup$ Hello and welcome. Please don't write in all caps in the title or body of any posts, it is the written equivalent of shouting, is harder to read and may be considered rude. Please use the edit button below the post to change you text into regular case. $\endgroup$ May 9 at 10:45
  • $\begingroup$ Oh, I didn't know that. Sorry for the misunderstanding. I will keep it in mind for the future. $\endgroup$ May 9 at 11:21

1 Answer 1

5
$\begingroup$

//EDIT: Now that I inspected the material I see where the problem lies - or at least I think it has something to do with what I see there. Within the material's nodegroups you are using 4D textures which of course makes sense, but the attribute value is stored on the surface of the sphere in all vertices. I may be completely wrong here but it led me to a working answer: do not use the Realize Instances on the "Atmosphere" geometry and use Type: > Instancer in the material.

Now you might say this did not work, and that is no wonder: you have no instances. You are adding two UV Sphere mesh primitives, but those are not instances. So I would do the following:

New simpler answer thanks to Gorgious:

  1. Replace the Realize Instances nodes in your setup with Geometry to Instance nodes. Now you can use the Type > Instancer on the Attribute node in the material shader.

    new nodetree setup

Older complicated answer:

  1. Go into Edit Mode of your base object, select all vertices with A, then M > Merge > By Distance. Now the original base mesh is only a single vertex. Go back to Object Mode.

  2. Go to the Geometry Nodes editor. Unfortunately you have deleted the Geometry input, so select the Group Input and add a new input, switch the Type to Geometry. Move it to the top of the list (this is important!).

    add new geometry input

  3. Now add two Instance on Points node. Plug the new Geometry socket into both of the Points inputs. Plug the "Planet" frame's output into one of the Instance inputs and the the one from the Atmosphere frame into the other. The Instances outputs get plugged into the Join Geometry node.

    instance on points

  4. With the Attribute Domain > Instance for the "Cloud Density" output and the Attribute node set to Type > Instancer in the material this should now work as expected, at least for the atmosphere. If the planet for some reason needs its instance to be realized, you can do this before the Join Geometry node.

    nodetree setup

$\endgroup$
17
  • $\begingroup$ Okay, I gave your suggestion a try but it still won't work as expected. I appended the blend-file via dropbox link to my initial post if you want to have a look. $\endgroup$ May 9 at 11:22
  • $\begingroup$ You also need to change the output attribute data type to Mesh i.stack.imgur.com/B5fng.png $\endgroup$
    – Gorgious
    May 9 at 12:06
  • 1
    $\begingroup$ @SolomonTheScapegoat I've looked into the material shader and now I've edited my answer to hopefully solve the problem. $\endgroup$ May 9 at 13:41
  • 1
    $\begingroup$ For step 3 you can also use the node Geometry to Instance if I followed correctly then you don't need the two instance on points nodes. $\endgroup$
    – Gorgious
    May 9 at 15:19
  • 1
    $\begingroup$ @Gorgious Oh good to know, I didn't know this existed. In that case actually step 1 and 2 are completely unnecessary. $\endgroup$ May 9 at 15:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .