Results 1 to 2 of 2

Thread: User light shaders, custom sampling

  1. #1
    Join Date
    Jul 2015
    Posts
    2

    Default User light shaders, custom sampling

    I am trying to write a light shader that would be of user-defined type.
    I cannot find any examples either on the writing mental ray shaders, nor on the devkit folder.

    On the light shaders documentation in http://docs.autodesk.com/MENTALRAY/2...tml#SECTION118

    Is says that: "mental ray supports an additional user-defined area light source, which leaves sample point selection completely to the light shader. The shader is expected to select points on its surface, cast shadow rays at these points if required, and return the illumination from that point. mental ray treats such lights as zero-dimension point lights, without any further information on origin and direction. Instead, the light shader modifies the values state→org and state→dir as necessary, including any dependent values like state→dist and state→dot_nd. The shader is called repeatedly until it returns (miBoolean)2. A call counter is provided in state->count, which is 0 for the first call, and counts up to 65536 (normally a few or a few tens of calls are considered sufficient)."

    However I am not sure how to go about selecting the points and casting the shadow rays.
    To give a bit more context, I have some volumetric light data and the options that came to mind where either create a point light at each voxel or the user defined light option.

    I would appreciate any insight into the issue, and specially any example code that implements even a simple user defined light shader.

  2. #2
    Join Date
    Jul 2015
    Posts
    2

    Default

    I managed to solve it on my own, in case it helps anyone after me the code for my user defined light shader is here https://github.com/Garoe/bath-fire-s...lume_light.cpp. At the moment the repository is private, but I'll be changed to public in the next few weeks.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •