Board index FlightGear Development Effects and shaders

Texture tiling: materials file or hardware?

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

Texture tiling: materials file or hardware?

Postby agillanders » Thu Jun 08, 2017 10:32 am

I am having trouble with tiling of a grass texture. I have tried using the agriculture effect, but without success. The material definition I am using is this:
Code: Select all
  <material>
    <name>Woodland-Sparse</name>
    <effect>Effects/agriculture</effect>
   <texture-set>
      <texture>Terrain/grass_dry2a.png</texture>
      <texture n="16">Terrain/grass_dry3.png</texture>
   </texture-set>
    <parameters>
      <overlay_fraction>0.5</overlay_fraction>
      <overlay_scale>50.0</overlay_scale>
      <distortion_factor>0.3</distortion_factor>
      <rotation_flag>1</rotation_flag>
      <rotation_scale>100.0</rotation_scale>
      <uv_xoffset>0.0</uv_xoffset>
      <uv_yoffset>0.0</uv_yoffset>
    </parameters>
    <xsize>100</xsize>
    <ysize>100</ysize>
    <light-coverage>0</light-coverage>
    <wood-coverage>30000.0</wood-coverage>
    <tree-texture>Trees/subtropical-au.png</tree-texture>
    <tree-varieties>5</tree-varieties>
    <tree-height-m>25.0</tree-height-m>
    <tree-width-m>15.0</tree-width-m>
    <rolling-friction>1</rolling-friction>
    <bumpiness>1</bumpiness>
  </material>


The result I get is simply the base texture tiled across the terrain. There is a screen capture at <https://www.dropbox.com/s/xhdesu91s50fpw7/Screen%20Shot%202017-06-08%20at%207.10.31%20PM.png?dl=0> is you wish to see the output.

The machine I am using is a Macbook Air, with Intel HD Graphics 5000 (which Apple says is capable of running OpenGL 4.1). I had shader quality turned up to 5. I am running FG 2017.2.1.

My first question is: have I got the <texture-set> and <parameters> right in the materials file? I followed the Procedural Texturing article on the wiki, and looked at some other examples, and I think the materials file is right.

My next question is this: I know that some hardware has trouble with some shaders. If my computer was unable to run the agriculture shader, what would I see? No texture at all? Corrupted texture? Correct texture but low frame rate?

This is really about debugging materials file changes. I am trying to distinguish between materials file errors, and materials definitions that my computer cannot execute.

Thanks
Andrew
agillanders
 
Posts: 7
Joined: Fri Jun 02, 2017 3:12 am

Re: Texture tiling: materials file or hardware?

Postby Thorsten » Thu Jun 08, 2017 11:21 am

To get the obvious out of the way - is the agriculture effect enabled at all in the shader control?

(My general experience is that if a shader isn't working, you see something obvious - black terrain, weird flickering colors, that kind of thing. )

Also, I think agriculture won't deliver what you're looking for for grassland - I've usually done grass using the standard terrain procedural techniques because they generate smooth, organic transitions and not the hard edged areas characteristic of man-made landclasses.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Texture tiling: materials file or hardware?

Postby agillanders » Thu Jun 08, 2017 12:37 pm

Yes, the agriculture shader was switched on. I tried the default shader as well, but got the same result. With shader quality set to 5, other shaders, as far as I can see, such as the water shader, are working beautifully. So, it would seem the problem is not that the shader is not working, but that it is not being activated? Is there anything I can check to see what is happening internally, maybe something on the property tree to see what is active or disabled at run-time?

Thanks
Andrew
agillanders
 
Posts: 7
Joined: Fri Jun 02, 2017 3:12 am

Re: Texture tiling: materials file or hardware?

Postby Thorsten » Thu Jun 08, 2017 12:59 pm

With shader quality set to 5, other shaders, as far as I can see, such as the water shader, are working beautifully.


Doesn't really answer the question - I don't think the agriculture effect is activated by the gross quality setting, you need the detailed shader dialog to do that.

So, it would seem the problem is not that the shader is not working, but that it is not being activated?


Generally a shader isn't activated whenever it fails the predicate check. If you look into

$FGdata/Effects/agriculture.eff

you'll see a section inside <predicate> with several conditions. This tells you what the effect wants to have in order to run - partially these are properties which you can check, partially these are OpenGL version check and supported extensions (which all ought to be supported all over the place these days anyway).
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Texture tiling: materials file or hardware?

Postby Thorsten » Thu Jun 08, 2017 2:31 pm

Anyway, your material declaration is sound - this is what it results in:

Image
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Texture tiling: materials file or hardware?

Postby agillanders » Sun Jun 11, 2017 6:35 am

Thanks, Thorsten. I had the shader quality set to 5, but when I looked at the individual shaders, the transition shader was set too low. I increased that, and it did help. However, instead of getting the base and overlay textures mixed across the land class, I got large areas of the base texture interspersed with large areas of overlay texture, each of which showed tiling. I won't persue this further just now, as I think I can get an acceptable solution with modifying the texture file.
agillanders
 
Posts: 7
Joined: Fri Jun 02, 2017 3:12 am

Re: Texture tiling: materials file or hardware?

Postby Thorsten » Sun Jun 11, 2017 7:02 am

Quoting myself: Also, I think agriculture won't deliver what you're looking for for grassland - I've usually done grass using the standard terrain procedural techniques because they generate smooth, organic transitions and not the hard edged areas characteristic of man-made landclasses.

I got large areas of the base texture interspersed with large areas of overlay texture, each of which showed tiling.


You are aware that your definitions control the patch size?

You can get quite appealing solutions for grassland (multiple exist) with the 3+ texture overlay scheme the standard terrain shader provides.

(In the (unlikely) case that you can demonstrate the shader can not do something you want it to, it can potentially be extended if the function is possible).
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Texture tiling: materials file or hardware?

Postby agillanders » Wed Jun 14, 2017 10:30 am

Yes, Thorsten, I had switched to terrin-default.eff for the land class as you suggested, but I found that by itself did not solve the prblem. I have done some more experimenting, and got much better results with some new textures that I created from the grass_dry*.png textures. There is still a bit of tiling, but it is not highly visible. Thanks. Case closed.
agillanders
 
Posts: 7
Joined: Fri Jun 02, 2017 3:12 am

Re: Texture tiling: materials file or hardware?

Postby Thorsten » Wed Jun 14, 2017 1:10 pm

Do you want to submit your materials definitions to the repository, or is this for some custom scenery?
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Texture tiling: materials file or hardware?

Postby agillanders » Fri Jun 16, 2017 7:54 am

The materials are for custom scenery. Eventually, I would like to make it available in some form, but it is not ready yet.
agillanders
 
Posts: 7
Joined: Fri Jun 02, 2017 3:12 am


Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 2 guests