HDRI lighting

Software: Away3D 4.x

_kihu, Jr. Member
Posted: 02 January 2013 03:20 PM   Total Posts: 43

Hey,

I’m trying to find the best quality for lighting a scene in Away3d. I’ve learned that in 3D Studio Max it is common to use Image Based Global Lighting technique (http://en.wikipedia.org/wiki/Image-based_lighting).

I’ve looked for this kind of solution in Away3D and found this:  http://www.derschmale.com/2009/01/13/hdr-lighting-in-fp10-away3d/

Notice that the demo is almost 4 years old! I guess I can re-write this in Away3D 4.0 but I’m wondering why this technique is so unpopular. Would it be better to go with the light probes solution (http://www.derschmale.com/2011/12/27/convolution-light-probes-in-away3d-4-0/)?

What solutions you think are the best?

   

_kihu, Jr. Member
Posted: 03 January 2013 10:44 AM   Total Posts: 43   [ # 1 ]

I’ve found out that the current class for doing this is called EnvMapAmbientMethod, but for the life of me I can’t get it to work.

Here’s some code:

cubeTexture = new BitmapCubeTexture(Cast.bitmapData(EnvPosX), Cast.bitmapData(EnvNegX), Cast.bitmapData(EnvPosY), Cast.bitmapData(EnvNegY), Cast.bitmapData(EnvPosZ), Cast.bitmapData(EnvNegZ));
   
   
   var 
bd:BitmapData = new BitmapData(44false0xffffff);
   
mat = new TextureMaterial(new BitmapTexture(bd));
   var 
amb:EnvMapAmbientMethod = new EnvMapAmbientMethod(cubeTexture);
   
mat.ambientMethod amb;

scene.addChild(new SkyBox(cubeTexture));
   
         
sphere = new Mesh(new SphereGeometry(1504020), mat);
         
sphere.300;
         
sphere.160;
         
sphere.300;
         
   
scene.addChild(sphere); 

The final result is a black sphere. EnvMapMethod works in the same setup.

   

_kihu, Jr. Member
Posted: 04 January 2013 10:51 AM   Total Posts: 43   [ # 2 ]

Since EnvMapAmbientMethod renders only black I got back to Light Probes and encountered a problem. In example: https://github.com/away3d/away3d-examples-fp11/blob/master/src/Intermediate_LightProbes.as

I removed mainLight and changed headMaterial’s light sources to probes

headMaterial.lightPicker = new StaticLightPicker([lightProbeFLlightProbeFRlightProbeNLlightProbeNR]);
headMaterial.diffuseLightSources LightSources.PROBES;
headMaterial.specularLightSources LightSources.PROBES

This ended with error:

at RegisterPool/requestFreeVectorReg()
[RegisterPool.as:46]
[Fault] exception, information=Error: Register overflow!

   

_kihu, Jr. Member
Posted: 04 January 2013 11:54 AM   Total Posts: 43   [ # 3 ]

Ok, so it worked:)

I’ve removed one of the probes from the lightpicker.
I’ve brought back the mainLight into the lightpicker, but I set it’s ambient, specular and diffuse to zero, so it doesn’t interfere with probe lights.
I’ve added specularMaps to the remaining 3 probes (just generated white BitmapData sized 256,256).

I’m still to learn if the number of probes limitation is gpu-specific or if there’s some other reason.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X