Board index FlightGear Development Effects and shaders

Effects for models in 2.0.0

An exciting "new" option in FlightGear, that includes reflections, lightmaps, the particle system etc.. A lot is yet to be discovered/implemented!

Re: Effects for models in 2.0.0

Postby i4dnf » Wed Mar 31, 2010 8:07 am

uhm, try to put the vec3 values as floats.
Code: Select all
<myparams type="vec3">5.0 200.0 5.0</myparams>

if that doesn't work try to normalize the values to 0..1.
(my fault for writing a dirty example :( )
Last edited by i4dnf on Wed Mar 31, 2010 8:16 am, edited 2 times in total.
i4dnf
Retired
 
Posts: 745
Joined: Wed Sep 09, 2009 7:17 am
Location: LRBS
Callsign: YR-I4D
Version: GIT
OS: Gentoo Linux ~amd64

Re: Effects for models in 2.0.0

Postby Thorsten » Wed Mar 31, 2010 8:11 am

Still no luck - continues to kill fgfs...
Thorsten
 
Posts: 10988
Joined: Mon Nov 02, 2009 8:33 am

Re: Effects for models in 2.0.0

Postby i4dnf » Wed Mar 31, 2010 8:14 am

i was editing my post at the time you were posting, try to normalize the values to 0..1.
they should be about 0.2, 0.8, 0.2
i4dnf
Retired
 
Posts: 745
Joined: Wed Sep 09, 2009 7:17 am
Location: LRBS
Callsign: YR-I4D
Version: GIT
OS: Gentoo Linux ~amd64

Re: Effects for models in 2.0.0

Postby Thorsten » Wed Mar 31, 2010 8:22 am

:( No, didn't help either. It's really the

Code: Select all
<attribute>
        <mypars type="vec3">0.2 0.8 0.2</mypars>
        <value type="int">1</value>
      </attribute>


part - when I comment that out, the thing runs fine (I don't read the parameters in the shader yet as long as things crash, I just want to get the vector passed before doing anything), when I uncomment it it crashes, regardless if I put integers, floats or normalized floats in.

Could this be a version thing - I'm running a 2.0.0 binary, maybe that's only supported in CVS?
Thorsten
 
Posts: 10988
Joined: Mon Nov 02, 2009 8:33 am

Re: Effects for models in 2.0.0

Postby i4dnf » Wed Mar 31, 2010 8:26 am

might be, if you can package a small example and put it somewhere for download i could test it later on a cvs build.
hmm, just looked at the original cloud.eff, and got another idea, maybe it's the index that's wrong (i see in it they use 10 and 11).. try setting the index to 10 (both in the original definition, and the asignment to usrAttr3)
(too bad the shader part isn't really well documented yet, and we have to guess our way through it :( )
i4dnf
Retired
 
Posts: 745
Joined: Wed Sep 09, 2009 7:17 am
Location: LRBS
Callsign: YR-I4D
Version: GIT
OS: Gentoo Linux ~amd64

Re: Effects for models in 2.0.0

Postby Thorsten » Wed Mar 31, 2010 8:38 am

No, wasn't the index either... Okay, I'll get a small example scenario ready for download later on - thanks for your help!
Thorsten
 
Posts: 10988
Joined: Mon Nov 02, 2009 8:33 am

Re: Effects for models in 2.0.0

Postby AndersG » Wed Mar 31, 2010 3:29 pm

Thorsten wrote:No, wasn't the index either... Okay, I'll get a small example scenario ready for download later on - thanks for your help!


I might have misunderstood what you are trying to do but are you sure it is an attribute you need/want? As I've understood it they are per-vertex and would be expected to be sent to the graphics card as part of the vertex buffer. If you want to send a constant that is equal for all verticies this would be called a uniform. I think constant uniforms work in 2.0.0 while uniforms linked to properties require FG/CVS.

/Anders
Callsign: SE-AG
Aircraft (uhm...): Submarine Scout, Zeppelin NT, ZF Navy free balloon, Nordstern, Hindenburg, Short Empire flying-boat, ZNP-K, North Sea class, MTB T21 class, U.S.S. Monitor, MFI-9B, Type UB I submarine, Gokstad ship, Renault FT.
AndersG
 
Posts: 2442
Joined: Wed Nov 29, 2006 9:20 am
Location: Göteborg, Sweden
Callsign: SE-AG
OS: Debian GNU Linux

Re: Effects for models in 2.0.0

Postby Thorsten » Thu Apr 01, 2010 6:44 am

Yes, I want to pass one constant which is the same for all vertices of the model. So what do I do - presumably something like
Code: Select all
 <uniform>
        <name>my_parameter</name>
        <type>float</type>
        <value type="float">0.5</value>
      </uniform>


in the effect file - but how do I retrieve that in the shader code?
Thorsten
 
Posts: 10988
Joined: Mon Nov 02, 2009 8:33 am

Re: Effects for models in 2.0.0

Postby AndersG » Thu Apr 01, 2010 7:53 am

Thorsten wrote:Yes, I want to pass one constant which is the same for all vertices of the model. So what do I do - presumably something like
Code: Select all
 <uniform>
        <name>my_parameter</name>
        <type>float</type>
        <value type="float">0.5</value>
      </uniform>


in the effect file - but how do I retrieve that in the shader code?


Hopefully by adding

uniform float my_parameter;

at the top level of the shader file.

/Anders
Callsign: SE-AG
Aircraft (uhm...): Submarine Scout, Zeppelin NT, ZF Navy free balloon, Nordstern, Hindenburg, Short Empire flying-boat, ZNP-K, North Sea class, MTB T21 class, U.S.S. Monitor, MFI-9B, Type UB I submarine, Gokstad ship, Renault FT.
AndersG
 
Posts: 2442
Joined: Wed Nov 29, 2006 9:20 am
Location: Göteborg, Sweden
Callsign: SE-AG
OS: Debian GNU Linux

Previous

Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 1 guest