Demomaster application framework with wxpython navigator

Return to Showcase

Postby ThomasEgi » Sat Jun 13, 2009 2:36 pm

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

this one locks itself up
Code: Select all
import direct.directbase.DirectStart
import gtk
run()


but this one works just fine.
Code: Select all
import gtk
import direct.directbase.DirectStart
run()


sounds like a pretty nasty issue. would this affect all text-reading such as egg files ,too?
User avatar
ThomasEgi
 
Posts: 2147
Joined: Fri Jul 28, 2006 10:43 am
Location: Germany,Koblenz

Postby drwr » Sat Jun 13, 2009 3:35 pm

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

David
drwr
 
Posts: 11253
Joined: Fri Feb 13, 2004 12:42 pm
Location: Glendale, CA

Postby drwr » Sun Jun 14, 2009 11:28 am

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
drwr
 
Posts: 11253
Joined: Fri Feb 13, 2004 12:42 pm
Location: Glendale, CA

Postby ThomasEgi » Sun Jun 14, 2009 12:00 pm

thx for the fix. :) 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 :) )

thx again.
User avatar
ThomasEgi
 
Posts: 2147
Joined: Fri Jul 28, 2006 10:43 am
Location: Germany,Koblenz

Postby mavasher » Thu Jun 18, 2009 5:11 pm

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.

Image

Any ideas on how the stop the flickering?
On Panda3DProjects.com:
http://www.p3dp.com/?mavasher
User avatar
mavasher
 
Posts: 294
Joined: Thu Feb 08, 2007 10:32 am
Location: Texas

Postby clcheung » Thu Jun 18, 2009 7:13 pm

Very interesting shader. Can you show your shader source ?

If your ball has a texture and your shader assume one ?
User avatar
clcheung
 
Posts: 574
Joined: Wed Jan 21, 2009 7:23 am

Postby ditus » Thu Jun 18, 2009 9:20 pm

the shader looks good, but a bit slow. which hw r u using?
is the idea of the lenov diing? no!
the aries is already on build :)
User avatar
ditus
Troll
 
Posts: 277
Joined: Mon Oct 15, 2007 2:15 pm
Location: moon

Postby mavasher » Thu Jun 18, 2009 10:56 pm

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


Image

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:

Code: Select all
//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.
On Panda3DProjects.com:
http://www.p3dp.com/?mavasher
User avatar
mavasher
 
Posts: 294
Joined: Thu Feb 08, 2007 10:32 am
Location: Texas

Postby rdb » Fri Jun 19, 2009 1:08 am

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 rarely respond to PMs
rdb
 
Posts: 8575
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby mavasher » Fri Jun 19, 2009 7:18 am

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.

Code: Select all
//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 );
}
On Panda3DProjects.com:
http://www.p3dp.com/?mavasher
User avatar
mavasher
 
Posts: 294
Joined: Thu Feb 08, 2007 10:32 am
Location: Texas

Postby mavasher » Fri Jun 19, 2009 9:03 pm

Sorry about the double post I just thought this would be a good piece of code to put here. I modified the reflection shader to accept the model's own texture and blend the two together. I have to say that realtime this thing is a lot more impressive but even so- Here's my results.

Image

Youtube video: http://www.youtube.com/watch?v=dN1e9G9V7yo

Here's the code.
Code: Select all
//Cg
//Cg profile arbvp1 arbfp1
//clcheung Mar 2009, base on The Cg Tutorial
//modified by mavasher
void vshader(
    in float4 vtx_position : POSITION,
   in float2 vtx_texcoord0 : TEXCOORD0,
   in float4 vtx_color : COLOR0,
   in float3 vtx_normal: NORMAL,
   in uniform float4 k_eyePositionW,
    uniform float4x4 mat_modelproj,
   uniform in float4x4 trans_model_to_world,
    out float4 l_position : POSITION,
   out float2 l_texcoord0 : TEXCOORD0,
   out float4 l_color : COLOR0,
   out float3 l_R : TEXCOORD1)
   
{
    l_position = mul(mat_modelproj, vtx_position);
   l_texcoord0 = vtx_texcoord0;
   l_color = vtx_color;
   float3 positionW = mul(trans_model_to_world,vtx_position).xyz;
   float3 N = mul((float3x3)trans_model_to_world, vtx_normal);
   N=normalize(N);
   float3 I = positionW - k_eyePositionW;    
   l_R = reflect(I, N);
}

void fshader(
   in uniform float4 k_param1,
    in float3 l_R : TEXCOORD1,
   in uniform samplerCUBE k_texcube : TEXUNIT1,   //UNIT0
    in float2 l_texcoord0: TEXCOORD0,
   in float4 l_color        : COLOR0,
    in sampler2D tex_0 : TEXUNIT0,
   out float4 o_color: COLOR0
    )
{
   float4 r;
   r.xyz = l_R;
   r.w = k_param1.y; // reflection blur
   
   
   float4 tex = tex2D(tex_0, l_texcoord0);
   
   
   float4 reflectedColor = texCUBEbias(k_texcube, r);
   float4 partcolor = lerp(l_color, reflectedColor, 1) ;
   o_color = lerp(tex, partcolor, k_param1.x);
}                             
Last edited by mavasher on Sat Jun 20, 2009 9:46 am, edited 1 time in total.
On Panda3DProjects.com:
http://www.p3dp.com/?mavasher
User avatar
mavasher
 
Posts: 294
Joined: Thu Feb 08, 2007 10:32 am
Location: Texas

Postby clcheung » Fri Jun 19, 2009 10:47 pm

Thank your for sharing this shader.

Yes, the original code has a missing set texture call on the virus egg. I found it also recently.
User avatar
clcheung
 
Posts: 574
Joined: Wed Jan 21, 2009 7:23 am

Postby astelix » Sat Jun 20, 2009 3:45 am

(to admins and everybody) how about to stick a page with a collection of the best shaders around everybody could pick a-la-carte?
My Rig:
P3D 1.7.0@WinXP & Kubuntu 10.04- Athlon 64 5200 X2 ~ Radeon 3200HD (integrated)
User avatar
astelix
 
Posts: 866
Joined: Mon Mar 27, 2006 4:36 pm
Location: Milano, ITA

Postby mavasher » Sat Jun 20, 2009 7:48 am

I agree with astelix.

One suggestion: All the shaders should include a screenshot and the shader inputs from the python script.
On Panda3DProjects.com:
http://www.p3dp.com/?mavasher
User avatar
mavasher
 
Posts: 294
Joined: Thu Feb 08, 2007 10:32 am
Location: Texas

Postby Arkaein » Sat Jun 20, 2009 12:40 pm

Is anyone not able to run demomaster because of a missing wx.aui module? I'm running on Kubuntu 9.04, and I have wxPython installed, but I get the following error:

Code: Select all
Traceback (most recent call last):
  File "demomaster.py", line 36, in <module>
    import demomain
  File "/home/matt/Development/Games/Panda3D/demomaster-0.7/demomain.py", line 28, in <module>
    import wxDemoControl
  File "/home/matt/Development/Games/Panda3D/demomaster-0.7/wxDemoControl.py", line 2, in <module>
    import wxPanelControl
  File "/home/matt/Development/Games/Panda3D/demomaster-0.7/wxPanelControl.py", line 6, in <module>
    import wx, wx.aui
ImportError: No module named aui


Is there some obscure (K)ubuntu package I could be missing? I have python-wxgtk2.6, python-wxgtk2.8, python-wxaddons, python-wxglade, python-wxtools, and python-wxversion installed.
Arkaein
 
Posts: 94
Joined: Sun Dec 10, 2006 12:56 pm

Postby mavasher » Sat Jun 20, 2009 1:13 pm

@Arkaein: Yup I think everyone has that problem. The issue I think is with the install package, it doesn't load up the wx.aui module. I just had to reinstall and I got it to work. I think other people on the forum had the same issue.

@everyone:

I built a crystal shader.


http://www.youtube.com/watch?v=UBAoU9TCl9U
Image

Code: Select all
//Cg
//Cg profile arbvp1 arbfp1

//by mavasher - based on some code by clcheung and ynjh_jo
void vshader(
    in float4 vtx_position : POSITION,
   in float4 vtx_color : COLOR0,
   in float3 vtx_normal: NORMAL,
   in uniform float4 k_eyePositionW,
    uniform float4x4 mat_modelproj,
   uniform float4 mspos_cam,
   uniform in float4x4 trans_model_to_world,
   out float  l_smooth,
   out float  l_facingRatio,
   out float4 l_position : POSITION,
   out float4 l_color : COLOR0,
   out float3 l_R : TEXCOORD1)
   
{
    l_smooth = smoothstep( -1.5,1,dot(vtx_normal, normalize(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_color = vtx_color;
   float3 positionW = mul(trans_model_to_world,vtx_position).xyz;
   float3 N = mul((float3x3)trans_model_to_world, vtx_normal);
   N=normalize(N);
   float3 I = positionW - k_eyePositionW;    
   l_R = reflect(I, N);
}

void fshader(
   in uniform float4 k_param1,
   in float  l_smooth,
   in float  l_facingRatio,
   in float3 l_R : TEXCOORD1,
   in uniform samplerCUBE k_texcube : TEXUNIT1,   //UNIT0
    out float4 o_color: COLOR0
    )
{
   float4 r;
   r.xyz = l_R;
   r.w = k_param1.y; // reflection blur
   
   float4 reflectedColor = texCUBEbias(k_texcube, r);

   o_color = float4(lerp(reflectedColor.rgb*l_smooth, reflectedColor.rgb*l_smooth, k_param1.x),l_facingRatio*2.5);
}                             
On Panda3DProjects.com:
http://www.p3dp.com/?mavasher
User avatar
mavasher
 
Posts: 294
Joined: Thu Feb 08, 2007 10:32 am
Location: Texas

Postby Arkaein » Sat Jun 20, 2009 5:26 pm

mavasher wrote:@Arkaein: Yup I think everyone has that problem. The issue I think is with the install package, it doesn't load up the wx.aui module. I just had to reinstall and I got it to work. I think other people on the forum had the same issue.


What exactly did you reinstall? I tried reinstalling the python-wxgtk2.8 Ubuntu package, but that had no effect. I then went to wxpython.org, found the instructions (at http://wiki.wxpython.org/InstallingOnUbuntuOrDebian) for upgrading to newer versions through an extra repository, installed most of the options (python-wxgtx2.8 conflicted with python-wxgtk2.8-ansi, but neither worked), but still could not get demomaster to run.

Any more clues?
Arkaein
 
Posts: 94
Joined: Sun Dec 10, 2006 12:56 pm

Postby clcheung » Sat Jun 20, 2009 9:03 pm

@Arkaein

I have no Linux installed and can't help much. I search around and the problem seems like a multiple pythons with incomplete wxpython installation issue.

@others about shader collections
It is a good idea. But it might be complicated to make working demos to show / experiment shaders in Panda environment.

I have rewritten some code in demomaster for easy creation of some demo scenes and one can add little applications with new shaders by inheriting from the demo scenes quickly. But it is bounded to demomaster's framework.
User avatar
clcheung
 
Posts: 574
Joined: Wed Jan 21, 2009 7:23 am

Postby Arkaein » Sun Jun 21, 2009 10:50 am

Okay, I was able to get demos running (without wx) by doing a few things. First I tried using the instructions to run without wx controls enabled, however the command line syntex has to be updated from what is in the top post, since the wx enable flag is now the fourth parameter, so I used a line like:

Code: Select all
python demomaster.py f f Ocean2Demo f


However this still gave the import error. To fix this issue I commented out the

Code: Select all
import wxDemoControl


in demomain.py. Clcheung, it might be nice if you could only conditionally import this when wx controls are enabled. That would let people with these wx errors run the demos.

One more suggestion: it would be nice if the software printed out a list of available demo names, since without a GUI the only way to determine the valid demo names is to open every demo source file.

Running the demos this way I noticed that several (e.e., the ODE demos) lacked any sort of action. Is it necessary to run using the wx GUI to trigger the actions in these demos?
Arkaein
 
Posts: 94
Joined: Sun Dec 10, 2006 12:56 pm

Postby clcheung » Sun Jun 21, 2009 7:12 pm

Arkaein, the main purpose of demomaster to allow quick and easy ways to change parameters in the demos, mainly for testing and experiment purpose. Currently there is no way to use the actions and attributes if the wx framework is not available. Quite a lot of demos requires the wx framework I am afraid.

I've thought about enabling a panda gui if wx is not available. But currently have no time to work on it yet.
User avatar
clcheung
 
Posts: 574
Joined: Wed Jan 21, 2009 7:23 am

Postby clcheung » Sun Jun 21, 2009 8:00 pm

Ok, I will take a look and implement a non-wx version in the coming one.
User avatar
clcheung
 
Posts: 574
Joined: Wed Jan 21, 2009 7:23 am

Postby Arkaein » Sun Jun 21, 2009 9:44 pm

clcheung wrote:Ok, I will take a look and implement a non-wx version in the coming one.


While that would be very nice, I didn't mean to suggest that an additional GUI would necessarily be worth the effort. I was mostly curious to see if I was missing anything, and was actually able to see the main effects of most demos by running from the command line.
Arkaein
 
Posts: 94
Joined: Sun Dec 10, 2006 12:56 pm

Postby clcheung » Sun Jun 21, 2009 10:25 pm

Arkaein wrote:
clcheung wrote:Ok, I will take a look and implement a non-wx version in the coming one.


While that would be very nice, I didn't mean to suggest that an additional GUI would necessarily be worth the effort. I was mostly curious to see if I was missing anything, and was actually able to see the main effects of most demos by running from the command line.


That's fine. I want to write a gui system anyway.

Without wx gui, probably you can run 50-70% of demomaster. If I add a simple menu system, likely 70-90% functions can be examined.
User avatar
clcheung
 
Posts: 574
Joined: Wed Jan 21, 2009 7:23 am

Postby clcheung » Thu Jun 25, 2009 2:57 am

June 25, 2009
Version 0.8
1. “Shaders – Hatching *” demos added for hatching effects
2. “Shaders – Compositor”
add “Hatching” screen effects
Image
Image
add “Multiple” screen effect
3. Performance tuning for ODE demos
4. “Shaders – Advance Demo 1”
Velvet shader added (seems not working well ?)
Mario, Crystal shader from mavasher added.
5. “Misc - Lens flare” demo added
From Legion - http://www.panda3d.org/phpbb2/viewtopic.php?t=3044
Image
6. Panda GUI option support (now demomaster can run with no wxpython installed).
Image
Image

Run “demomaster.py f f f” if you don’t want wxpython.
Last edited by clcheung on Thu Jun 25, 2009 7:24 pm, edited 1 time in total.
User avatar
clcheung
 
Posts: 574
Joined: Wed Jan 21, 2009 7:23 am

Postby astelix » Thu Jun 25, 2009 11:15 am

yikes! you finally trashed wx! :)
very less hassle for sure - I'm terribly curious to see the new demomaster edition but where is it? there is no 0.9 in the usual page...
My Rig:
P3D 1.7.0@WinXP & Kubuntu 10.04- Athlon 64 5200 X2 ~ Radeon 3200HD (integrated)
User avatar
astelix
 
Posts: 866
Joined: Mon Mar 27, 2006 4:36 pm
Location: Milano, ITA

Postby blenderkid » Thu Jun 25, 2009 2:00 pm

Hi,
I have a problem with this demomaster-program.
When I start it by "python2.5 demomaster.py" the program starts, but I can't press any buttons or scroll-down, so it hangs up.

Is this program usable on linux?

Do someone had this problem?

Thx, blenderkid
blenderkid
 
Posts: 85
Joined: Sat Jun 20, 2009 4:15 am
Location: Germany

Postby clcheung » Thu Jun 25, 2009 7:29 pm

@astelix

my mistake. it is version 0.8

@blenderkid

This is a good question. I have only tested it on Windows. The GUI is based on treegui, but with some modifications on top. I am not yet sure if I need to fix anything on Linux. Can astelix and other Linux users give some feedback after using it ?
User avatar
clcheung
 
Posts: 574
Joined: Wed Jan 21, 2009 7:23 am

Postby mavasher » Thu Jun 25, 2009 8:29 pm

Man, you've been up to a lot of work here.

The new additions are great. I noticed on the crystal and mario shaders that the results don't look very good with the monkey model. Maybe another model would look better.

Also, your velvet shader is interesting.
On Panda3DProjects.com:
http://www.p3dp.com/?mavasher
User avatar
mavasher
 
Posts: 294
Joined: Thu Feb 08, 2007 10:32 am
Location: Texas

Postby astelix » Fri Jun 26, 2009 2:53 am

yeah thankyou Cheung - I already got it watching closer the file dates on your repository.
By the way I'd to say that my actual work PC (rig1 in my signature) is going out of business regarding the demomaster 'cos it almost die under the weight of the power computing demand of the new stuff. I'm starting to think it's time to switch to the rig nr2, expecially after the new ati linux drivers update that fixed a lot of issues. Let see...
My Rig:
P3D 1.7.0@WinXP & Kubuntu 10.04- Athlon 64 5200 X2 ~ Radeon 3200HD (integrated)
User avatar
astelix
 
Posts: 866
Joined: Mon Mar 27, 2006 4:36 pm
Location: Milano, ITA

Postby Nemesis#13 » Sat Jul 18, 2009 11:08 pm

wohaa! :D
without wx it runs like a charm and nearly everything runs fine. there's so much usable code in this package, you could easily make a whole, well looking game with it!

thank you very much for this!

EDIT:
blenderkid wrote:Is this program usable on linux?

Do someone had this problem?

yupp. didn't work with wx for me either. try starting it with
Code: Select all
python demomaster.py f f f
User avatar
Nemesis#13
 
Posts: 1041
Joined: Mon Aug 04, 2008 8:09 pm
Location: Germany

PreviousNext

Return to Showcase

Who is online

Users browsing this forum: No registered users and 0 guests