Re: [osg-users] osg-users Digest, Vol 31, Issue 4

2010-01-05 Thread Julien Valentin
I Have used a copy of unchanged pixels and it works,
 but I have still a question:
I try to remove the pinponging by giving the 2 passes same textures as input
and output... ( new renderPass(texture[0],texture[0]))
And it works perfectly?!!! Performances are the same and i can use discard
Can someone can give me clues about why is it working as everywhere on the
net advise not to use a read/write texture in shader???


Hi,

try copying the input texture value to the output instead of using discard.
jp

Julien Valentin wrote:
 Hello all,
 I'm playing with the osg gameoflife example in order to implement a
 FastIterativeMethod using the pingpong textures and a FBO already in the
 example.
 This iterative method is looping over several GPU loops (a pixel
 shader)  until it converges ( all pixels are set).
 Pixel shader seems like it:
 main(){
 if (need to update current pixel)
  gl_FragColor=updatedcolor;
 elsegl_FragColor=oldcolor;;

 }
 It work fine but there's no convergence test in order to stop looping in
 the shader
 For the purpose of convergence test I would like to use an occulsion
 query that return the number of pixel setted in a loop (not discarded).
 For this I modify my shader:
 main(){
 if (need to update current pixel)
  gl_FragColor=updatedcolor;
 else discard;

 }
 So It discard fragment that dont need to be setted again with the same
value
 Now each pixel would  update  when it need otherwise it is would discard
 itself.

 But with this code the result on my textured quad s don't stop flicking
 between correct color and a checkboard ..:(

 Do you know where the problem  is?
 It seems to be like osg is not calling the two pingpong passes
 alternately...

 NB:To sum up, The only change I made from the osg gameOfLife  example is
 the shader where i introduces a discard branch...
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osg-users Digest, Vol 31, Issue 4

2010-01-05 Thread J.P. Delport

Hi Julien,

you might be lucky if your output pixel does not depend on any input 
neighbours. Imagine all output fragment shader progs being executed in 
parallel with no fixed order. If an output pixel depends on input 
neighbours, the input values might be overwritten before they are read.


I also tried this when I started osgpingpong (try it) and you get weird 
results.


jp

Julien Valentin wrote:

I Have used a copy of unchanged pixels and it works,
 but I have still a question:
I try to remove the pinponging by giving the 2 passes same textures as 
input and output... ( new renderPass(texture[0],texture[0]))

And it works perfectly?!!! Performances are the same and i can use discard
Can someone can give me clues about why is it working as everywhere on 
the net advise not to use a read/write texture in shader???



Hi,

try copying the input texture value to the output instead of using
discard.
jp

Julien Valentin wrote:
  Hello all,
  I'm playing with the osg gameoflife example in order to implement a
  FastIterativeMethod using the pingpong textures and a FBO already
in the
  example.
  This iterative method is looping over several GPU loops (a pixel
  shader)  until it converges ( all pixels are set).
  Pixel shader seems like it:
  main(){
  if (need to update current pixel)
   gl_FragColor=updatedcolor;
  elsegl_FragColor=oldcolor;;
 
  }
  It work fine but there's no convergence test in order to stop
looping in
  the shader
  For the purpose of convergence test I would like to use an occulsion
  query that return the number of pixel setted in a loop (not
discarded).
  For this I modify my shader:
  main(){
  if (need to update current pixel)
   gl_FragColor=updatedcolor;
  else discard;
 
  }
  So It discard fragment that dont need to be setted again with the
same value
  Now each pixel would  update  when it need otherwise it is would
discard
  itself.
 
  But with this code the result on my textured quad s don't stop
flicking
  between correct color and a checkboard ..:(
 
  Do you know where the problem  is?
  It seems to be like osg is not calling the two pingpong passes
  alternately...
 
  NB:To sum up, The only change I made from the osg gameOfLife
 example is
  the shader where i introduces a discard branch...




___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org