Board index FlightGear Development Effects and shaders

Volumetric grass (was 3D textures and volumetric data)

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

Re: Volumetric grass (was 3D textures and volumetric data)

Postby wlbragg » Tue May 30, 2017 11:27 pm

@archy,

If the <OR> isn't working try just replace the

<extension-supported>GL_EXT_geometry_shader4</extension-supported>

with

<extension-supported>GL_EXT_geometry_shader</extension-supported>

and see if that works.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 4927
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640

Re: Volumetric grass (was 3D textures and volumetric data)

Postby archy » Wed May 31, 2017 1:01 am

Nope, sorry! Did not help
archy
 
Posts: 20
Joined: Sat Jan 28, 2017 11:28 pm

Re: Volumetric grass (was 3D textures and volumetric data)

Postby Icecode GL » Wed May 31, 2017 9:41 am

It's hard to troubleshoot these problems. I have a really vague idea about Mesa - I haven't used it for years since I switched to propietary Nvidia drivers. My guess is that Mesa just doesn't support geometry shaders yet for certain cards/drivers/software rendering implementations. A quick Google search brought this, which clearly states that it's a multi-vendor extension (not limited to Nvidia only) and that the extension is available since OpenGL 1.1. My glxinfo outputs GL_EXT_geometry_shader4, while yours doesn't. Maybe there are some go-arounds but it's hard to come up with them when I'm not even familiar with AMD cards or anything that isn't the nvidia propietary driver.
Icecode GL
 
Posts: 542
Joined: Thu Aug 12, 2010 12:17 pm
Location: Spain
Callsign: icecode
Version: GIT
OS: Arch Linux

Re: Volumetric grass (was 3D textures and volumetric data)

Postby Thorsten » Wed May 31, 2017 9:42 am

It's hard to troubleshoot these problems.


Amen.
Thorsten
 
Posts: 11135
Joined: Mon Nov 02, 2009 8:33 am

Re: Volumetric grass (was 3D textures and volumetric data)

Postby archy » Thu Jun 01, 2017 12:14 am

That means we gave up?
archy
 
Posts: 20
Joined: Sat Jan 28, 2017 11:28 pm

Re: Volumetric grass (was 3D textures and volumetric data)

Postby Thorsten » Thu Jun 01, 2017 5:19 am

I think we've covered the obvious avenues and checked that the instructions given by the effect are not vendor-specific but should work. Yet your card doesn't follow the instructions for whatever reason which we can't figure out. That's pretty much all we can do without having an AMD card to experiment with.

I've had one instance where I had to replace

Code: Select all
pow(x, 4)
by
Code: Select all
x*x*x*x


to make the nouveau driver happy. You can't just guess these things, in that case this was formally correct code which just didn't work on nouveau for whatever reason.
Thorsten
 
Posts: 11135
Joined: Mon Nov 02, 2009 8:33 am

Re: Volumetric grass (was 3D textures and volumetric data)

Postby jarl.arntzen » Fri Jun 02, 2017 1:49 pm

On my Mac, I have to provide a float to get pow to work.
Does not work: pow(x,4);
Does work: pow(x,4.0);
Frequent Flyer. Occasional Lander.
jarl.arntzen
 
Posts: 106
Joined: Thu Jan 03, 2013 9:43 pm
IRC name: Jarl Arntzen
Version: 2017.1.1
OS: Ubuntu 14.04

Re: Volumetric grass (was 3D textures and volumetric data)

Postby Thorsten » Fri Jun 02, 2017 5:10 pm

I *think* that wasn't the problem and I just typed it wrongly here, but I'm not 100% sure any more. Anyway, assume that's like the problem and try spotting this in you code without any error message...
Thorsten
 
Posts: 11135
Joined: Mon Nov 02, 2009 8:33 am

Re: Volumetric grass (was 3D textures and volumetric data)

Postby archy » Fri Jun 02, 2017 5:34 pm

If there is some changes that i can make to the code I an willing to help out by editing source files and recompile on my computer to try solve the problem.
I guess the userbase of linux users with Gallium drivers is quite a few so it be ok for them to have flightgear compatible with they're setup too.
archy
 
Posts: 20
Joined: Sat Jan 28, 2017 11:28 pm

Re: Volumetric grass (was 3D textures and volumetric data)

Postby Icecode GL » Fri Jun 02, 2017 7:35 pm

Old GLSL versions don't allow implicit type casting, and the function is not defined for pow(float, int). Nvidia is usually more permissive with this stuff, while AMD is known to be quite picky in these situations.
Icecode GL
 
Posts: 542
Joined: Thu Aug 12, 2010 12:17 pm
Location: Spain
Callsign: icecode
Version: GIT
OS: Arch Linux

Re: Volumetric grass (was 3D textures and volumetric data)

Postby Thorsten » Sat Jun 03, 2017 5:14 am

Well, but AMD usually throws you an error message for undefined functions - if it doesn't work which you can use to fix it.

I've come across quite a few things which 'just' don't work without any error or warning. And I was under the impression that's also the case here - we don't have any error message or so in the log, it just doesn't work.
Thorsten
 
Posts: 11135
Joined: Mon Nov 02, 2009 8:33 am

Re: Volumetric grass (was 3D textures and volumetric data)

Postby Thorsten » Wed Jun 07, 2017 1:47 pm

@Icecode GL:

Started to code wind (not pushed yet). Initially it struck me that you're right and using the texture coordinates is much more elegant than to bias the bending function - and I got this to work nicely merging my gust generator code with your wind code.

Then I tried rotor downwash and re-discovered that you can't do any non-linear transformation of texture coordinates you like, the GPU will simply not do it. In particular I couldn't get a bending field radially outward from a location as for a column of descending air.

So unless you have a bright idea, we might need a mixed bag of tricks with the texture coordinate doing the overall wind bending and a bias distribution superimposing rotor and propwash.
Thorsten
 
Posts: 11135
Joined: Mon Nov 02, 2009 8:33 am

Re: Volumetric grass (was 3D textures and volumetric data)

Postby Icecode GL » Wed Jun 07, 2017 5:13 pm

Maybe I'm missing the point, but I think a gust of wind can be done like directional wind:

Code: Select all
uniform vec3 g_rawpos;
uniform vec3 wind_blast_pos;
[...]
vec2 texCoord = gl_TexCoord[0];
vec3 blastDir = normalize(wind_blast_pos - vec3(-g_rawpos.x, g_rawpos.yz));
float windFunction = <insert fancy wind function>;
float windDisplacement = windFunction * <insert fancy fluid mechanics aproximation to blade movement>;
texCoord += blastDir.xy * windDisplacement;
Icecode GL
 
Posts: 542
Joined: Thu Aug 12, 2010 12:17 pm
Location: Spain
Callsign: icecode
Version: GIT
OS: Arch Linux

Re: Volumetric grass (was 3D textures and volumetric data)

Postby Thorsten » Wed Jun 07, 2017 5:27 pm

No, I don't think it can.

I've constructed the vector from downwash center to the fragment in question. I can verify that I have tagged the right location by dropping fragments based on a length cut, so I get a movable spot in the grass. I can verify that the vector has the expected orientation by outputting it as a color code. So as far as I can check, the vector is as I would expect it to be.

Yet when I use the same vector to define a displacement field radially outward from the marked location, the grass doesn't bend as expected, rather I get some weird kind of whirl.

I've seen that before, trying to model slope patterns on rock by elongating the texture along the direction of steepest descent - texture coordinates are special, you can apply all linear transformations on them, and a few non-linear ones, but there's some that just don't work - despite to my best ability to check the code being algorithmically okay.
Thorsten
 
Posts: 11135
Joined: Mon Nov 02, 2009 8:33 am

Re: Volumetric grass (was 3D textures and volumetric data)

Postby Icecode GL » Wed Jun 07, 2017 5:44 pm

No, I don't think it can.

I just tried the code above and it works fine. Maybe you want a different kind of result?
I've constructed the vector from downwash center to the fragment in question.

If I understood correctly, that's same as
Code: Select all
vec3 blastDir = normalize(wind_blast_pos - vec3(-g_rawpos.x, g_rawpos.yz));

And all of these vectors together make up the displacement field you are describing.

May I have a look at some code? I can't seem to grasp exactly what you mean.
Icecode GL
 
Posts: 542
Joined: Thu Aug 12, 2010 12:17 pm
Location: Spain
Callsign: icecode
Version: GIT
OS: Arch Linux

PreviousNext

Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 2 guests