Jump to content

Material Cleanup - Help Needed


Recommended Posts

Hello everyone,

The other day I had a look at D94 which purpose is to clean up material files. As @vladislavbelov pointed out there are some other materials with useless tags and some are missing requires like the alpha test.

My second purpose is to update the material documentation

The third one is to determine what functionalities we support with materials so we can answer more easily one whether something is doable or not natively.

My first question is about 'USE_SPECULAR'

1.First does it require specular power and specular Color and does it require a spec texture or does the specular Color tag handle that.

2.Then can it be replaced by USE_SPECULAR_MAP everywhere 

So we can use <uniform name="effects Settings" value="X X X X "/> everywhere 

3. Does it makes sense to use effectsettings on let's say basic trans and set all the unused X params to 0 ?

Or should I use define and put it to 0

4 is it better to write

<define name='SPECULAR_MAP' value='1'>

<required_texture name='specTex'>

Or 

<required_texture name='specTex' define''SPECULAR_MAP"/>

5. Can I remove all the comments and put it in the documentation instead ?

6. What is the purpose of alternative materials ? Is it when switching from glsl to ARB ?

7. What is USE_TRIPLANAR ?

8. How does sim_time work ?

9. Should bump be renamed to parallax ?

10. Should we enable where possible and set quality requirements ?

USE_HQ_PARALLAX

USE_VHQ_PARALLAX

11. Is wind data required when using Use_wind ?

12. If you see any question with a not obvious answer I forgot to ask to do the doc feel free to add it. And answer it if you can

@leper @Itms @wraitii

Thanks in advance.

 

 

  • Thanks 1
Link to comment
Share on other sites

To answer I'm using shaders sources and my additional knowledge.

  1. USE_SPECULAR requires specular power and specular color.
  2. No, because USE_SPECULAR works without specular texture, but USE_SPECULAR_MAP with, also USE_SPECULAR_MAP requires specular effects.
  3. No, because effects are available only for USE_NORMAL_MAP, USE_SPECULAR_MAP, USE_PARALLAX or USE_AO.
  4. <required_texture name='specTex' define=''SPECULAR_MAP"/> is better, because you define connected things together.
  5. Where from comments? If materials, I think no, because it allows faster fix/add/improve shaders.
  6. No. It uses for conditional alternatives, i.e. basic_trans_ao.xml, if quality < 2 it switch to basic_trans.xml. Also it could be used when the material can't be supported, but it's not used, if I'm not mistaken.
  7. It's used for the triplanar texture mapping (vec3 instead of vec2). Currently It's used for the terrain.
  8. sim_time just a time since the game started, it's used for the water rendering (waves, etc) and for the wind animation.
  9. Where? It's not used in materials.
  10. I don't think so, only if add conditions.
  11. Yes, it's required.
  • Like 1
Link to comment
Share on other sites

@vladislav Thanks for the answers

5. Some comments in materials are useless as they describe AO effects while the material doesn't use them.
6. Should we use alternative materials where possible to optimise performance ?
9. There is a material called something_bump while it should be something_norm or something_parallax.
10. I'm not sure I understand.

11. How should materials who only have spec and parallax be handled ? ie (basic_trans_parallax_spec)

 

    <!-- Settings for effects above:
         First value: Normal mapping intensity.
	 Second value: Specular power.
	 Third value: Parallax scale.
	 Fourth value: AO amount. -->
	<uniform name="effectSettings" value="1.0 50.0 0.0075 0.85"/>
	<required_texture name="baseTex"/>
	<required_texture name="specTex" define="USE_SPECULAR_MAP"/>
	<required_texture name="normTex" define="USE_NORMAL_MAP"/>

Here it doesn't make sense as we specify a value for AO while the is no AO. Should we at least put the values to 0 so that it doesn't look like a stupid copy paste ?

12. What about 

        <define name="USE_PARALLAX" value="1"/>
	<required_texture name="normTex" define="USE_NORMAL_MAP"/>


Shouldn't it be this ?
 

<required_texture name="normTex" define="USE_PARALLAX"/>


Or does USE_PARALLAX require USE_NORMAL_MAP ?


 

  • Like 1
Link to comment
Share on other sites

5. They are.

6. No, we shouldn't because materials isn't a bottleneck.

9. Yes, it could be renamed I think, because is uses normal map as usual. But in common terms bump != parallax.

10. USE_HQ_PARALLAX and USE_VHQ_PARALLAX aren't used in shaders, so you could use it only if you add it (and add conditions)

11. If a material requires something and engine doesn't have it, then the material should be applied. Currently there could be a warning or crash, I don't remember.

12. No, it shouldn't, it's different things, normTex is a normal map, which could be used for different goals. And parallax just can use it if needed.

Link to comment
Share on other sites

@vladislavbelov

10.  Ah I see well I guess they should be removed then.

11.  Currently it warns about missing textures. But that was not what I meant. Here is an another exemple.

Assuming a material named like player_trans_parallax.xml (I cleaned it up)

<?xml version="1.0" encoding="utf-8"?>
<material>
    <define name="USE_PLAYERCOLOR" value="1"/>
    <define name="USE_PARALLAX" value="1"/>
    <shader effect="model"/>
    <required_texture name="baseTex"/>
    <required_texture name="normTex" define="USE_NORMAL_MAP"/>
    <uniform name="effectSettings" value="1.0 50.0 0.0075 0.75"/>
</material>

As needed that material requires a normal map, and a diffuse map. So far so good. But now let's look at this line 

<uniform name="effectSettings" value="1.0 50.0 0.0075 0.75"/>

1.0 defines diffuse texture power, so far so good.
50.0 defines specular power, which is retarded because we don't have any specular.
0.0075 defines parallax strength which is fine.
0.75 defines AO which then again is not used.

So should those useless values be 0 for consistency or should I write the material in another way ?

13 Can we use the effect settings value for USE_SPECULAR so we don't have to add another line ?
 

Edited by stanislas69
Link to comment
Share on other sites

11. No, you don't need to change something, it's ok that some parameters are not used. I want to make some modifications for the shader system, but it's in future.

13. As I said:

2 hours ago, vladislavbelov said:

No, because effects are available only for USE_NORMAL_MAP, USE_SPECULAR_MAP, USE_PARALLAX or USE_AO.

And not for USE_SPECULAR.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...