Table of Contents

Identifying Corona Shade Context

Corona uses 2 shade contexts - one for hit into the scene background (environment), and other for all geometry hits. Their Class_IDs are:

  • Scene geometry hit: a=0x6E816801, b=0xAD8731C5

  • Background (environment maps): a=0x6E816801, b=0xAD8731C6

Using Corona Shade Context

Corona shade contexts try to conform to 3ds Max API specifications as much as possible, but sometimes that is not possible for multiple reasons (confusing or ambiguous API documentation, design differences between a physically based renderer and the old rasterizer architecture the API was created for, …). Notable methods that do not work are:

  • Light()

  • GetEvalObject()

  • NodeID()

You can get additional functionality with the Execute method. When passing constexpr int CORONA_GET_INSTANCE_ID = 0x389A7625 as cmd argument, scene geometry hit ShadeContext will return a unique ID of the currently hit object instance (of type uint64_t). This can be used for example to randomize color between different instances.