POV-Ray : Newsgroups : povray.beta-test : Colored specular highlights feature request : Re: Colored specular highlights feature request Server Time
28 Apr 2024 20:59:38 EDT (-0400)
  Re: Colored specular highlights feature request  
From: Simon Copar
Date: 1 Mar 2013 15:05:01
Message: <web.513109605a3186c065a03f8f0@news.povray.org>
Thank you, nice to know that this is being considered.

A few comments:

> - Pattern-based control over highlights is indeed quite a frequent
> feature request; to some degree similar effects can be achieved by using
> a texture map, but this is only half the truth: Where extreme but
> gradual changes in highlight roughness are desired, texture maps won't
> get you anywhere. However, I think this is better catered for by a
> "finish map"; after all, when you vary highlights chances are that you
> will also want to vary diffuse and specular reflection along with it.

finish map would really be perfect for modulating roughness, intensity and
reflection parameters. However, it has a disadvantage that you lose the color
information: you get one-parameter (gray) modulation, even if you specify color
for each gray level separately. For full effect (although this would not be used
frequently) you would still need a pigment inside the highlight block.

> - One thing that should be considered when developing a new highlights
> syntax is that some day we might see blurred reflections, in which case
> a direct correlation between reflection and highlights settings would be
> strongly desirable. So maybe the highlights settings should be part of
> the reflection block in the first place, in which case we'll possibly
> end up with no other highlights-specific parameter than just the model
> to use (the "roughness" parameter would be shared with blurred reflections).

This is perfect from a physical point of view, as specular reflection is really
simply a fake blurred reflection term for point sources. For rendering purposes,
you probably still want a mixed option (sharp reflections, blurred highlight),
to speed up the rendering if you don't really nead blurred reflections. This is
however easily solved if it is possible to layer reflection/highlight
statements.

If I get wildly creative, I can envision another option (highly speculative):

If there will be a change in syntax, we could make it completely uniform in the
sense of shaders. We technically have a sum
diffuse+specular+reflection+emission. These are really just 4 separate blocks
with different ray sampling distribution (BDRF).
The "pigment" statement now regulates the diffuse and ambient part. But each of
the contributions could have its own pigment and own parameters. This way you
could say
texture {
  model [diffuse|phong|blinn|reflection|emission|other ray distribution
functions]
  blend_mode [add|overlay]
  pigment { for each contribution its own color or pattern }
  finish {//model-specific settings:
     brilliance,ambient (for diffuse)
     roughness/phong_size (for highlights)
     fresnel [on/off] (for highlights and reflections)
     radiosity [on/off] //sampling of additional rays beside the light rays
     sample_lights [on/off] //this would turn off the direct illumination - for
instance, to avoid artifacts for models with very sharp distributions
  }
}

This covers absolutely everything. if "model" is not specified, it can default
to diffuse, and for backward compatiblity (if #version<reference version) it can
still calculate phong/specular/reflection statements from finish.

If model is specified, you reproduce all existing things in a uniform way:
diffuse + radiosity off: normal illumination
diffuse + radiosity on: normal illumination + traditional radiosity
reflection + radiosity on: traditional (perfect) reflection - one radiosity ray
per pixel is just the reflection ray
phong + radiosity on: this is the blurred reflection model (radiosity sample
rays distributed according to phong reproduce the blurred reflection)
phong + radiosity off: traditional phong
phong + radiosity on + sample_lights off: no traditional (light-source) phong,
just blurred reflection.
emission: emissive color/pattern, no need to sample radiosity or lights, this
part just contributes to illumination of camera and other parts of the scene

Every "model" can have its own C++ class with different light-sampling and
radiosity-sampling functions for collecting the data, and each could have its
own pigment. Various new shaders can be added without changing the syntax, you
just create a new class that knows how to generate outgoing rays according to
some distribution and calculate weights for light rays.

The blend_mode is necessary to allow adding of contributions (just adding light
intensity) and normal texture layering (alpha channel, opaque color covers what
is underneath). For diffuse, it would default to "overlay", and for other
contributions, it would default to "add", so you would normally not need to set
this at all, unless you want special effects.

A reflective red sphere with normal highlight and blue-tinted reflection could
have a texture like:
texture {
  model diffuse
  pigment { color rgb <1,0,0> }
  //default, no finish needed unless you want to change something
}
texture {
  model phong
  pigment { color rgb 0.5 }
  finish { roughness 0.05 fresnel on }
}
texture {
  model reflection
  pigment { color rgb <0,0,1> }
  finish { intensity 0,1 fresnel on }
  normal {} //reflections can have perturbed normals even if other parts don't
}

Again, this is simply what I imagine would be the cleanest and most flexible
syntax. Maybe this gives you some ideas, or maybe not.

best,
Simon


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.