Demomaster application framework with wxpython navigator

Version 0.6 major changes

  1. Facial Expression for human model added. Major bug fixes and enhancement on the animation engine.
  2. Hair added for human model, experimental.
  3. ODE Car, enhanced version of ninth @ discourse.panda3d.org/viewtopic.php?t=5646
    car model, sound, skydome, camera views added.
  4. “Shaders – Facing Ratio” added
    Facing Ratio Shader, from ynjh_jo discourse.panda3d.org/viewtopic … acingratio
  5. Several Morphing Demos added, including Captain Blender
  6. More compatible with version 1.6.x
  7. PSSM shadow manager added (but not used)

Videos
youtube.com/watch?v=uvXcrUza5j4
youtube.com/watch?v=a5Gy578goIQ

Known bugs:
motion delay related shaders in Compositor is not correct in 1.6.x
the head of Human 1 will disappear at certain angle
Captain Blender’s texture is not correct
Water surface demo sometimes is not working.
Sound in ode car may not sounds right in 1.5.4.

cool work as always the shader compositor is total awesomness
one Q: how is supposed to work captain blender? I don’t see modifiers in the functions panel

keep up the good work!

Click on the attributes panel, and play with the joints (morphing targets). You can control the facial expression of Captain Blender through morphing capability of panda.

ok now I got it - excellent demo!

Version 0.7 release:

Use Psyco if installed
“Misc - Volumetric Light Demo” added (just a simple test)
“Misc – HDR Test” added (just a simple test)
“Shaders – DOF” Depth of Field shader added

“Shaders – Sun” Sun shader added
youtube.com/watch?v=IZvbeQLfLy4
“Shaders – Compositor” add:

  • Heat effect
  • Old TV
  • Old Movie
  • ASCII 2 (an improved version of ASCII)
  • Half tone
  • Bloom 2
  • Tone Mapping

“Misc – Pool Demo” added

Bugs fixes for vtf water demos (to be able to run on 1.6.x)

Hi clcheung,

Downloaded version 0.7 today - total awesomeness! Keep up the good work :smiley:

Once I figured out that there are functions and attributes it just became so much better… And the ASCII renderer is super interesting.

i have encountered some VERY strange issues after upgrading to ubuntu 9.04 64bit.

firstoff. it locked itself up upon starting. only warning output was:

:prc(warning): Invalid floating-point value for ConfigVariable simple-thread-epoch-timeslice: 0.05

i encounter the same thing with all panda applications as soon as i import the gtk module.
strange enough it works again after putting “want-pstats 1” into the config.prc.
then it wont lock itself up anymore but will raise a number of other issues:
first would be those 2 warnings:

:prc(warning): Invalid floating-point value for ConfigVariable simple-image-threshold: 0.1
:prc(warning): Invalid floating-point value for ConfigVariable egg-coplanar-threshold: 0.01

resulting in most samples having seriously scrabled image ouput (very blocky rasterisation. this is what the disco-sample looks likehttp://imagebin.org/52328

most likely due to this rough rasterisation most samples refuse to run and crash with errors simmilar to this one:http://dpaste.com/55015/
there where a few more samples running with slightly different issues but i guess most are based upon this strange gtk-related bug.

That sounds like the localization issue described here: https://discourse.panda3d.org/viewtopic.php?t=1458. I thought we had eliminated the possibility of this happening, but apparently it’s snuck back in. The fundamental problem is that some localization setting gets changed which changes the low-level C runtime library’s floating-point parser, so that refuses to parse numbers such as “0.5” (expecting instead a comma like “0,5”). You can imagine what merry chaos this change has on Panda’s internal workings when suddenly all floating-point numbers fail to be parsed correctly.

David

now that you mention it… my previous system was set up with english as default language. this time i picked german.
the thing is… panda itself runs perfectly fine… only when gtk is imported it goes crazy

Ah, that’s interesting. Well, that might make sense: Panda explicitly sets the language to the “C” locale for parsing numbers when it starts up. I bet gtk is setting it back to the user’s requested locale when it starts up.

David

gtk or wx . both cause the same issue.
looks like you’r right.

this one locks itself up

import direct.directbase.DirectStart
import gtk
run()

but this one works just fine.

import gtk
import direct.directbase.DirectStart
run()

sounds like a pretty nasty issue. would this affect all text-reading such as egg files ,too?

Yep, and that’s what causes your models to look all blocky.

David

FYI, I linked the wrong thread originally. The first time we encountered this problem with the locale was in this thread, not that it matters much.

I’ve just checked in a better workaround. The new workaround replaces the system atof() and strtod() calls with our own implementation, which is not locale-specific. Should solve this problem once and for all.

David

thx for the fix. :slight_smile: wonder why noone else run into the issue so far. despite the number of non-english systems out there. well i’ll keep an eye on it and report back if i still encounter problems ( i hope i dont need to :slight_smile: )

thx again.

First off, Excellent work putting all of this together.

I’m interested in using some of the shaders you have shown off here. I modified ynjh_jo’s facingRatio code to create an XRay (See through) shader.

Everything’s fine with the shader. It works great. But I’m having trouble with the scene itself. The scene flickers like crazy. It’s cycling through the cubemap textures to paint some of the objects. I changed the scene and took out the virus and panda and added a ball.

The girl doesn’t have any problems but the ball flickers through the cubemap, here I have it capturing the grass texture in the screenshot.

Any ideas on how the stop the flickering?

Very interesting shader. Can you show your shader source ?

If your ball has a texture and your shader assume one ?

the shader looks good, but a bit slow. which hw r u using?

It’s no slower than the original. Frame rate drops when I screen capture. I just modified one variable in one line.

The earth on the right is the original shader from the demo.
The other earth and the girl are using the xray shader.

BTW, I got the flickering to stop. The issue is that the model needs a texture. The ball I was using is a blank model.

Here’s the Xray shader:

//Cg

void vshader(
             float4 vtx_position : POSITION,
             float2 vtx_texcoord0 : TEXCOORD0,
             float3 vtx_normal : NORMAL,
             uniform float4x4 mat_modelproj,
             uniform float4 mspos_cam,
             uniform float4 mspos_light,

          out float  l_smooth,
          out float  l_facingRatio,
             out float2 l_texcoord0 : TEXCOORD0,
             out float4 l_position : POSITION
             )
{
  // SMOOTH SHADING : dot product ranges from -1~1, scale it so I get 0~1,
  // but before it, I set the ambient light to .2,
  // so it's .5/2.5 (2.5 is -1.5~1 range), add the .5 to the dark side
  l_smooth = smoothstep( -1.5,1,dot(vtx_normal, normalize(mspos_light-vtx_position)) );
  l_facingRatio = pow( 1.0-saturate( dot(vtx_normal, normalize(mspos_cam-vtx_position)) ), 2 );
  l_position = mul(mat_modelproj, vtx_position);
  l_texcoord0=vtx_texcoord0;
}

void fshader(
             in float2 l_texcoord0: TEXCOORD0,
          in float  l_smooth,
             in float  l_facingRatio,
             uniform float4 k_envirLightColor,
             sampler2D tex_0 : TEXUNIT0,

             out float4 o_color:COLOR)
{
  float4 tex = tex2D(tex_0, l_texcoord0);
//   o_color = float4( tex.rgb*l_smooth, tex.a );
  o_color = float4( lerp(tex.rgb*l_smooth, k_envirLightColor.rgb, l_facingRatio) , l_facingRatio*2 );
}

The last “l_facingRatio*2” is what I changed. The “2” is a simple scalar- increasing this number will increase the power of the texture- it will make it less transparent.

When you are referencing a texture from within a shader, but it doesn’t exist - or you aren’t passing it, it will show you random textures.

I get it now. In the original scene before I changed the shader had the same problem. I think the Panda and the virus have segments that aren’t textured.

I created a variation on the Xray shader. This one doesn’t blend the colors with another color (white in our case), it just uses the texture from the model.

//Cg
//XRay shader number 2
//Shader maintain object texture 
void vshader(
             float4 vtx_position : POSITION,
             float2 vtx_texcoord0 : TEXCOORD0,
             float3 vtx_normal : NORMAL,
             uniform float4x4 mat_modelproj,
             uniform float4 mspos_cam,
             uniform float4 mspos_light,

          out float  l_smooth,
          out float  l_facingRatio,
             out float2 l_texcoord0 : TEXCOORD0,
             out float4 l_position : POSITION
             )
{
  // SMOOTH SHADING : dot product ranges from -1~1, scale it so I get 0~1,
  // but before it, I set the ambient light to .2,
  // so it's .5/2.5 (2.5 is -1.5~1 range), add the .5 to the dark side
  l_smooth = smoothstep( -1.5,1,dot(vtx_normal, normalize(mspos_light-vtx_position)) );
  l_facingRatio = pow( 1.0-saturate( dot(vtx_normal, normalize(mspos_cam-vtx_position)) ), 2 );
  l_position = mul(mat_modelproj, vtx_position);
  l_texcoord0=vtx_texcoord0;
}

void fshader(
             in float2 l_texcoord0: TEXCOORD0,
          in float  l_smooth,
             in float  l_facingRatio,
             uniform float4 k_envirLightColor,
             sampler2D tex_0 : TEXUNIT0,

             out float4 o_color:COLOR)
{
  float4 tex = tex2D(tex_0, l_texcoord0);
//   o_color = float4( tex.rgb*l_smooth, tex.a );
  o_color = float4( lerp(tex.rgb*l_smooth, tex.rgb*l_smooth, l_facingRatio) , l_facingRatio*2 );
}