Author Topic: object attributes in Corona  (Read 443 times)

2023-10-31, 18:32:01

busseynova

  • Active Users
  • **
  • Posts: 21
    • View Profile
I'm trying to create a master material for a range of fabrics. I've used this method before with Vray, but something isn't playing nicely now. My method then was to use a custom user attribute to pass on an index to an OSL 1ofN node which picks the appropriate map and passes it on to the material.

I just found this in the OSL documentation:

Quote
'OSL also allows the generic getattribute() function to get a named attribute from the scene. It is up to the renderer executing the OSL code to populate these named attributes, which means it is outside the control of the OSL Map itself to guarantee whether these attributes are defined.'

Does this mean that Corona can't get object attributes for shader level functions?

Any alternative mathods anyone would like to suggest? I am trying to use object ID as an alternative via a CoronaMultiMap, but it doesn't seem to be working currently.


2023-11-01, 09:37:36
Reply #1

Aram Avetisyan

  • Corona Team
  • Active Users
  • ****
  • Posts: 561
    • View Profile
Hi,

I am not sure what your exact workflow looks like, but it sounds that what you need and want to do is possible through CoronaUserProperty map:
https://docs.chaos.com/display/CRMAX/Corona+User+Property+Map

You can user it in combination with CoronaMultiMap of course.
The video in the link also demonstrate a simple usage of the map, feel free to check it out.
Aram Avetisyan | chaos-corona.com
Chaos Corona Support Representative | contact us

2023-11-01, 10:26:10
Reply #2

Frood

  • Active Users
  • **
  • Posts: 1922
    • View Profile
    • Rakete GmbH
but something isn't playing nicely now.

Maybe you are just not aware of the fact that you need to restart interactive rendering when changing object properties to see the result. Because your example just works here :)

And yes, if assigning IDs would be ok for you, plug all maps into a CoronaMultimap node, check only "Object GBuffer ID" and that's it.

You can user it in combination with CoronaMultiMap of course.

What exactly are you referring to? While you can use both, OSL named attribute and CoronaUserProperty to get a value, you cannot use it to either control CoronaMutimap nor CoronaSelectMap afaik.


Good Luck



Never underestimate the power of a well placed level one spell.

2023-11-01, 17:49:44
Reply #3

busseynova

  • Active Users
  • **
  • Posts: 21
    • View Profile
Quote
Maybe you are just not aware of the fact that you need to restart interactive rendering when changing object properties to see the result. Because your example just works here :)

haha thanks, yes I realised this shortly after posting.

Quote
OSL named attribute
Ok, I stand corrected, it does work! I think it was the same issue, I wasn't refreshing the interactive render.

Quote
CoronaMutimap

Yeah I can't see how this works. Would be great if it did as you have the batch texture import there