Here’s my problem: I make with GN leaves instances over a surface. all works fine but things become impossible when i want to make a per-instance color variation.
Between attributes, properties, GN outputs and many other things i confess i’m lost.
Of course i’m stuck because i don’t know GN enough and this is very frustrating.
What i’d like to do is quite simple: in GN, modulate color with a color ramp attacked by a random-per-instance value, and retrieve the color variation in shader to apply it to each instance.
Yes this is what i’d like to do
And among the legions of things i tried-out, i tried this one too ( store named attrib ) and it seems not to work…
You’re on B3.2 and i suspect the store named attrib node is buggy in 3.2. It works when you choose point in store names attr, and geometry in shader node attribute but this is not what i want as it gives a per vertex color variation similar on all instances.
Could you please confirm or infirm your setup works in B3.2 ? or post the blend ?
EDIT: i got a probably stoopid question but… Are the geo nodes behaviour hardcoded in blender C code ? or are they some script ( python or XML or anything else ) that could be modified after compile time ?
EDIT2: my bad. It is not the GN STORE NAMED ATTRIBUTE that is bugged. It is the shader node ATTRIBUTE that seems unable to retrieve an attribute when in instancer request
yes i think it is the only way to achieve what i want to do.
I would have preferred to handle the color modulation in the geonodes but as the shader attribute node don’t behaves properly with the instancer parameter i got no choice
I was trying to print out the color output from Color ramp, but unsuccessfully. The closest value I found for this was “default_value”, but… I need current one instead. Per each instance. Is that possible? Something like following:
import bpy
print("NEW")
# Define the input node name
input_node_name = "VALTORGB"
# Iterate through selected objects
for ob in bpy.context.selected_objects:
# Check if the object has an active material
if ob.active_material:
material = ob.active_material
# Check if the material has a node tree
if material.node_tree:
node_tree = material.node_tree
# Find the specified input node
for node in node_tree.nodes:
#print(node.type)
if node.type == input_node_name:
print(node.outputs[0].value) # '.value' is not valid. How to get this value in Python?
Edit.: Ah, I just noticed that after making instances real, all that randomized color variations is not retained… Is possible to make them real without loosing color variation somehow?