[x3d-public] EnvironmentLight comment
GPU Group
gpugroup at gmail.com
Mon Jun 6 07:44:12 PDT 2022
Here's a diary rant I did this morning to try and iron out my own confusion
on EnvironmentLight and how it relates. Feedback welcome.
-Doug
CUBEMAP CONCEPTUAL
cubemaps are textures and should be treated as such:
- multitexturing
- texture transforms, including multitexture transforms (imagine clouds and
stars rotating at different speeds)
- SphericalMapBackground : BackgroundNode, SphericalMap {}
What's different about Cubemaps: they use vertex normals as their texture
coordinates by default
- any texture transform is a textureCoordinate transform
- texture transforms for spherical maps would be 3D and could be defined as
a rotation axis-angle, routed to as such
--browser internal would do inverse transpose, so scene designer doesnt
have to
EnvironmentMap are similar - can take a cubemap
And spherical harmonics are a single-channel spherical map
SphericalHarmonicMap : SphericalMap
CubeMap : SphericalMap
EnvironmentMap/Light : SphericalMap, Light
Q. what's the difference between an environmentLight and a PointProjector?
A. PointProjector the texture/light is going outward, like PointLight
EnvironmentProjector - texture is coming inward, like a cubemap
Projectors use implicit method of texture mapping - mathematical formulas
instead of texture coordinates.
Projectors use shape frag vertex coordinates for texture lookup
Spherical maps use frag normals for texture lookup
2D textures use frag texture2D coordinates for texture lookup
Texture Light
Spherical Cubemap, TBackground, SH EnvironmentLight,
PointProjector, SH
2D Texture2D Projector
Q. what's the difference between a Light and a Texture?
A.
1. its what the receiving Shape/Appearance does with the sample
a) uses it as a diffuse material
b) uses reflective light math on it
and
2. where declared
a) scene level above the Shape, ::childNode - same texture applies to all
shapes as a 'light', has a location/orientation specified and some math to
get from shape to texture
b) in Appearance - its a 'texture' applied to one shape, and with an
implicit location, orientation relative to shape
Q. could we have a generic childer node:
- converts any non-child node into a child equivalent by locating it, so it
can apply to/affect peers/siblings or globally
X3DChilder : X3DChildNode, X3DLocator, X3DAffector
{
SFBool global TRUE
SFVec3f location //when affecting siblings (global=FALSE), node
this node must be at same level as
SFRotation orientation //..peers it is to affect, so can't be wrapped in a
Transform
SFNode node
}
Q. what is a Background - Texture or Light?
A. Neither. Its a Shape, showing a texture. Not providing a diffuse texture
(projection) nor light to other shapes.
- but if there was a checkbox/boolean field for light, then it could become
an environment light
- and in theory there can be a a boolean global field, and when off, light
part will just affect siblings, else whole scene
- whether to use it as a cubemap texture or a light can be over-ridden in
the receiving Shape/Appearance
SphericalMap : Light, Texture
{
//first 3 fields are 'default recommendations' to Shape.Appearance, which
can over-ride
SFBool texture FALSE
SFBool project FALSE
SFBool light TRUE
SFBool inward TRUE //outward is PointProjector, inward is
EnvironmentLight/Cubemap, applies to light or project=TRUE
SFNode sampleSource NULL
[SphereicalHarmonicsNode,MultitextureCube,CubeMaptexture]
}
MultitextureCube - allows TextureCoordinates3DNormaized, and
TextureTransform3DRotation
TextureTransform3DRotation : TextureTransform3D
{
SFRotation rotation [0 1 0 0.0] //convenient to route to for example clouds
moving in the sky = f(Time)
}
ConventionalBackground: SphericalMap
{ texture TRUE, light FALSE }
BackgroundLight : SphericalMap
{light TRUE inward TRUE texture TRUE}
Q. whats an EnvironmentLight?
A. its a (cubemap/SH used as a) Light, used in lighting math as reflective
(vs Cubemap is a texture)
EnvironmentLight: SphericalMap
{texture FALSE light TRUE inward TRUE }
Q. what's a PointProjector?
A. its a (cubemap, SH used as a) Texture or Light, projecting outward
PointProjector : SphericalMap
{ inward FALSE light TRUE texture FALSE }
Q. what's the difference between punctual and areal lights?
A. punctual resolve/resolve to a single sample per fragment, of either a
texture or pointlight
- areal require multipe samples of same source for same fragment
- example using a colored rectangle as a light. From the frag, where would
the sample come from? Perhaps sample its 4 corners punctually like
pointLights, and compute an (angular) area as seen from frag, and apply
math to get a center and magnitude equivalent - a computational method to
punctualize. None of the above is area lights -- all single sample per
fragment.
SUMMARY: Cubemaps need to be treated like full textures, with
multitexturing, texturetransforms and texturecoordinates specialized.
Sphereical harmonics uses a different sampler, but still uses (receiving
Shape) frag normal for lookup like CubeMaps, and is non-areal (punctual) in
the sense it gives one sample per frag, and would use a 3D rotational
TextuereTransform and so should share a common ancestor (abstract?) type
with Cubemaps, perhaps SphericalMap.
HYPOTHESIS: internally browsers can implement something like a
SphereicalMap and specialize it for a number of current web3d node types,
and then add a few new / strange nodes like ComplexBackground and
PointProjector at little additional cost.
/CUBEMAP CONCEPTUAL
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20220606/7fef3bc7/attachment.html>
More information about the x3d-public
mailing list