Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate colours in flat shading for Issue #380 #382

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 40 additions & 9 deletions infinigen/core/rendering/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,18 +225,49 @@ def configure_compositor_output(


def shader_random(nw: NodeWrangler):
# Code generated using version 2.4.3 of the node_transpiler
# Code generated using version 2.6.5 of the node_transpiler
object_info_1 = nw.new_node(Nodes.ObjectInfo_Shader)

object_info = nw.new_node(Nodes.ObjectInfo_Shader)
value = nw.new_node(Nodes.Value)
value.outputs[0].default_value = 10

white_noise_texture = nw.new_node(
Nodes.WhiteNoiseTexture, input_kwargs={"Vector": object_info.outputs["Random"]}
)
divide = nw.new_node(Nodes.Math, input_kwargs={0: 1.0000, 1: value}, attrs={'operation': 'DIVIDE'})

divide_1 = nw.new_node(Nodes.Math, input_kwargs={0: object_info_1.outputs["Random"], 1: divide},
attrs={'operation': 'DIVIDE'})

floor = nw.new_node(Nodes.Math, input_kwargs={0: divide_1}, attrs={'operation': 'FLOOR'})

multiply = nw.new_node(Nodes.Math, input_kwargs={0: floor, 1: divide}, attrs={'operation': 'MULTIPLY'})

divide_2 = nw.new_node(Nodes.Math, input_kwargs={0: object_info_1.outputs["Random"], 1: divide},
attrs={'operation': 'DIVIDE'})

fract = nw.new_node(Nodes.Math, input_kwargs={0: divide_2}, attrs={'operation': 'FRACT'})

divide_3 = nw.new_node(Nodes.Math, input_kwargs={0: fract, 1: divide}, attrs={'operation': 'DIVIDE'})

floor_1 = nw.new_node(Nodes.Math, input_kwargs={0: divide_3}, attrs={'operation': 'FLOOR'})

multiply_1 = nw.new_node(Nodes.Math, input_kwargs={0: floor_1, 1: divide}, attrs={'operation': 'MULTIPLY'})

divide_4 = nw.new_node(Nodes.Math, input_kwargs={0: divide_2, 1: divide}, attrs={'operation': 'DIVIDE'})

fract_1 = nw.new_node(Nodes.Math, input_kwargs={0: divide_4}, attrs={'operation': 'FRACT'})

divide_5 = nw.new_node(Nodes.Math, input_kwargs={0: fract_1, 1: divide}, attrs={'operation': 'DIVIDE'})

floor_2 = nw.new_node(Nodes.Math, input_kwargs={0: divide_5}, attrs={'operation': 'FLOOR'})

multiply_2 = nw.new_node(Nodes.Math, input_kwargs={0: floor_2, 1: divide}, attrs={'operation': 'MULTIPLY'})

combine_color = nw.new_node(Nodes.CombineColor,
input_kwargs={'Red': multiply, 'Green': multiply_1, 'Blue': multiply_2})

emission = nw.new_node(
"ShaderNodeEmission", input_kwargs={"Color": combine_color, "Strength": 0.5})
_ = nw.new_node(Nodes.MaterialOutput, input_kwargs={'Surface': emission})

nw.new_node(
Nodes.MaterialOutput,
input_kwargs={"Surface": white_noise_texture.outputs["Color"]},
)


def global_flat_shading():
Expand Down