Page MenuHome

Object Info node support for GLSL mode and the internal render

Authored by Alexander Romanov (a.romanov) on Dec 21 2016, 6:46 PM.

Diff Detail

rB Blender

Event Timeline

Update for the current master

Brecht Van Lommel (brecht) requested changes to this revision.Apr 9 2017, 6:52 PM

Looks generally fine to me, always nice to have more complete GLSL support.


Can you add a comment that the logic here is designed to match Cycles?

Or even better, expose this random number in RNA so Cycles and other renderers can use it instead of duplicating code.


Code convention is to always use {}


Code convention is to always use {}.

This revision now requires changes to proceed.Apr 9 2017, 6:52 PM
Alexander Romanov (a.romanov) edited edge metadata.
  1. Fixed style
  2. random_id added to RNA. Now it is interpreted as signed int on Python side (regardless PROP_UNSIGNED). We can leave it as is, or make convertion to float [0,1]. What could be the best solution?

I think it should be unsigned int as you did. It's what I would expect anyways, we don't want different colors assigned to materials because of float precision problems.
Do you know how to make Cycles to use this RNA value?

Do you know how to make Cycles to use this RNA value?

First, I don't know how to return it as unsigned to Python.

We don't have an unsigned int type in RNA, but exposing it as an int should be fine. In practice casting unsigned int -> int -> unsigned int is a no-op.

Using expanded random_id in Cycles

Update for the current state of master branch

Great, looks good to me now. I confirmed the random values in Cycles stayed the same.

This revision is now accepted and ready to land.Apr 14 2017, 4:13 PM
This revision was automatically updated to reflect the committed changes.