qdtk / openshadinglanguage

Automatically exported from code.google.com/p/openshadinglanguage
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Create a debug closure #19

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
or outputing debug buffers like "normals" or "texture" (colors) we need a new 
closure type that would treated in a special 
way inside the integrator. This closure, just like the BSDFClosure would 
inherit from Closure primitive and would only have 
one method:

  Color3 eval(const void *paramsptr, Labels &labels);
We use color as a fixed type but it can represent a single float in a greyscale 
way or a vector. It will work as long as the 
user redirects the output to a AOV of the appropiate type. It can of course 
return labels and in fact we will need a new 
label in the medium category (see #79) called DEBUG so we can filter them. The 
user will be able to add custom flags too. 
So to provide a debug value from OSL they would do something like this:

  Ci = ... + debug(N, "label", "normals") + ... ;
    or
  Ci = ... + debug(color(u, v, 0), "label", "texcoords");
    or
  Ci = ... + debug(color(roughness,roughness,roughness),"label","texcoords");
But we can make the debug opcode to accept different types and automatically 
cast them to the internal color (or triplet) 
value. So the osl code would look like:

  Ci = ... + debug(N, "label", "normals") + ... ;
   or
  Ci = ... + debug(vector2(u, v), "label", "texcoords") + ...;
   or
  Ci = ... + debug(roughness, "label", "texcoords") + ...;
So in arnold, if we want to have the normals as an RGB image we would map a 
pattern like this:

  osl_path_regexps 1 1 STRING "normals RGB C(d"normals")
That syntax for that kind of regexp with custom labels still doesn't exist and 
I made up the "d" for the DEBUG label, but 
thats the basic idea. You can have several debug values at the same time and 
you can redirect them to different buffers.

Original issue reported on code.google.com by rene.lim...@gmail.com on 11 Jan 2010 at 6:30

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by rene.lim...@gmail.com on 13 Jan 2010 at 1:13

GoogleCodeExporter commented 9 years ago
Lowering priority and moving the milestone back... it's not clear that we need 
this
any longer.  But I won't close it out quite yet, in case Shading changes their 
minds.

Original comment by larrygr...@gmail.com on 22 Jan 2010 at 11:38