qdtk / openshadinglanguage

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

texture() should take optional param for missing texture #48

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Currently, texture() lookups to nonexistent textures are an error (that
propagates up to the renderer).  The shader team has suggested that it
would solve some awkwardness if there was an optional argument to texture,
somewhat similar to "fill", that gives a color value to use for entirely
missing textures (and it is not an error for this to occur).  If the arg is
not supplied, it's an error to ask for texture that is not found.

I can think of a couple ways to do this: 

(1) a separate "missing" color that is analogous to "fill" (fill is used
for missing channels in a present texture).  Also a "missingalpha" for the
alpha case?

(2) just a bool that means whether or not a missing texture is an error.
  (2a) just use the fill value when missing?
  (2b) use a global value for missing texture value? (via
shadingsys->attribute)  Do you need a different color on a shader-by-shader
basis?

Opinions?

Original issue reported on code.google.com by larrygr...@gmail.com on 14 Jan 2010 at 8:10

GoogleCodeExporter commented 9 years ago
Sample comment (I'm just testing the email)

Original comment by larrygr...@gmail.com on 14 Jan 2010 at 8:23

GoogleCodeExporter commented 9 years ago
I would want a separate color per shader, and would not like 2b. And "fill" is a
float, and I'd not always want the missing color to be greyscale. I would 
prefer (1).

Original comment by jonogi...@gmail.com on 14 Jan 2010 at 11:55

GoogleCodeExporter commented 9 years ago
Agreed.  After I posted that, I was convinced from internal discussion that it 
needed
to be a shader decision (example: you might want missing color texture to be a
different "average" than a missing displacement amount).  And yes, I'm going to 
make
it a color.

Original comment by larrygr...@gmail.com on 14 Jan 2010 at 11:59