Author Topic: .sdr file question and Lighting Issues again  (Read 12095 times)

0 Members and 1 Guest are viewing this topic.

Offline ARSPR

  • Preys On Mantis
  • 29
Re: .sdr file question and Lighting Issues again
You could create a new page called GLSL Support or something and link to it from the Development Reference page.
Done: OpenGL Shaders (GLSL)

(I've also tweaked Command Line help. It didn't contain -normal, -height, -weapon_choice_3d, -no_glsl, ...)
« Last Edit: March 04, 2009, 06:14:04 pm by ARSPR »
IF YOU HAVE TROUBLES WITH FS2:
  • Please, please, please, READ and UNDERSTAND the sticky threads in FreeSpace & FreeSpace Open Support board.
    A lot of people are willing to help you, but, as anyone can understand, seeing the very same "issues" repeated again and again can become quite depressing. Please, spend a bit of time trying to solve the issue by yourself.
    (Lobo deserves a monument).
  • Then, if you aren't still able to solve your issue, feel free to ask for help in that same board.
    FYI, most of the troubles are caused by wrong mod installations which lead to either missing data or undesired cross-effects between them. Always follow the mod installation instructions and keep a clean FS2 installation as explained in the sticky threads. Two additional links about how the game handles game data:
  • If you think that you've discovered a bug, mantis it.
    Provide as much info as you can, and try to narrow it down. A lonely "FS2 doesn't work" is not a good report.

Whoever Hanlon was: Never attribute to malice that which can be adequately explained by stupidity.
Albert Einstein: Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe.

Dell Dimension 9200 - Vista 32-bit Ultimate
Core 2 Quad Q6600 @2.4GHz - RAM 2 GB DDR2
nvidia 8800 GTX - Integrated Sigmatel Audio

 

Offline chief1983

  • Still lacks a custom title
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: .sdr file question and Lighting Issues again
Great job, lots of good info there.  If you see any other place on the Wiki that should link to that article, don't hesitate to add it.  I just picked the first one that made sense.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline Zacam

  • Magnificent Bastard
  • Administrator
  • 211
  • I go Sledge-O-Matic on Spammers
    • Steam
    • Twitter
    • ModDB Feature
Re: .sdr file question and Lighting Issues again
Made one minor correction: The coded number of supported shaders (ATM) is 66, not 67. The MediaVP shaders currently have a miscellaneous orphan file.

I also added 2 (General) Wiki links on defining Shaders and GLSL as well as the link to the OpenGL GLSL docs page.

I also added links for Shader Tools or Libraries by various Vendors that I could easily find. The list contains links to OpenGL Orgs own Shader Designer, nVidia's FX Composer, ATI's Render Monkey and recent ASHLI and Apples OS-X OpenGL stuff.
Report MediaVP issues, now on the MediaVP Mantis! Read all about it Here!
Talk with the community on Discord
"If you can keep a level head in all this confusion, you just don't understand the situation"

¤[D+¬>

[08/01 16:53:11] <sigtau> EveningTea: I have decided that I am a 32-bit registerkin.  Pronouns are eax, ebx, ecx, edx.
[08/01 16:53:31] <EveningTea> dhauidahh
[08/01 16:53:32] <EveningTea> sak
[08/01 16:53:40] * EveningTea froths at the mouth
[08/01 16:53:40] <sigtau> i broke him, boys

 

Offline ARSPR

  • Preys On Mantis
  • 29
Re: .sdr file question and Lighting Issues again
Made one minor correction: The coded number of supported shaders (ATM) is 66, not 67. The MediaVP shaders currently have a miscellaneous orphan file.

I also added 2 (General) Wiki links on defining Shaders and GLSL as well as the link to the OpenGL GLSL docs page.

I also added links for Shader Tools or Libraries by various Vendors that I could easily find. The list contains links to OpenGL Orgs own Shader Designer, nVidia's FX Composer, ATI's Render Monkey and recent ASHLI and Apples OS-X OpenGL stuff.

 :yes: :yes:

Hey, guys feel free to MODIFY the whole page if you want. I can assure that you do know more than me about shaders (it doesn't matter how little you know  ;) )
IF YOU HAVE TROUBLES WITH FS2:
  • Please, please, please, READ and UNDERSTAND the sticky threads in FreeSpace & FreeSpace Open Support board.
    A lot of people are willing to help you, but, as anyone can understand, seeing the very same "issues" repeated again and again can become quite depressing. Please, spend a bit of time trying to solve the issue by yourself.
    (Lobo deserves a monument).
  • Then, if you aren't still able to solve your issue, feel free to ask for help in that same board.
    FYI, most of the troubles are caused by wrong mod installations which lead to either missing data or undesired cross-effects between them. Always follow the mod installation instructions and keep a clean FS2 installation as explained in the sticky threads. Two additional links about how the game handles game data:
  • If you think that you've discovered a bug, mantis it.
    Provide as much info as you can, and try to narrow it down. A lonely "FS2 doesn't work" is not a good report.

Whoever Hanlon was: Never attribute to malice that which can be adequately explained by stupidity.
Albert Einstein: Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe.

Dell Dimension 9200 - Vista 32-bit Ultimate
Core 2 Quad Q6600 @2.4GHz - RAM 2 GB DDR2
nvidia 8800 GTX - Integrated Sigmatel Audio

 
Re: .sdr file question and Lighting Issues again
Why are there no l-f.sdr and lf-f.sdr in use when there are  l-v.sdr and lf-v.sdr files?
Why are the vertex shaders for which no fragment shaders can be created? If I create such files their outputs are ignored. What gives?

 

Offline taylor

  • Super SCP/Linux Guru
  • 212
    • http://www.icculus.org/~taylor
Re: .sdr file question and Lighting Issues again
Why are there no l-f.sdr and lf-f.sdr in use when there are  l-v.sdr and lf-v.sdr files?
Because l-f and lf-f wouldn't have any maps attached.  In such a case there is the null-f.sdr which is used instead and only applies shading.  But that should only ever happen in the lab, never in a mission (unless the model is b0rked), so a fog version isn't needed.

Quote
Why are the vertex shaders for which no fragment shaders can be created? If I create such files their outputs are ignored. What gives?
All of them are paired up by functionality and hard-coded in the exe.  You can only modify what's there, not create anything new, unless code changes are made.  And any changes that you do make to the shaders need to still fit in with the functionality assigned to that pair of shaders or else it won't work properly.

 
Re: .sdr file question and Lighting Issues again
Why are there no l-f.sdr and lf-f.sdr in use when there are  l-v.sdr and lf-v.sdr files?
Because l-f and lf-f wouldn't have any maps attached.  In such a case there is the null-f.sdr which is used instead and only applies shading.  But that should only ever happen in the lab, never in a mission (unless the model is b0rked), so a fog version isn't needed.

IN that case the pair should be lb-v.sdr and lb-f.sdr instead of l-v.sdr and lb-f.sdr as right now. That is confusing.

 

Offline taylor

  • Super SCP/Linux Guru
  • 212
    • http://www.icculus.org/~taylor
Re: .sdr file question and Lighting Issues again
IN that case the pair should be lb-v.sdr and lb-f.sdr instead of l-v.sdr and lb-f.sdr as right now.
The "b" indicator says that it's for a base (diffuse) map, which the vertex shader doesn't care about.  In the case you specify l-v.sdr and lb-v.sdr would be exactly the same, line for line.  It would be a complete waste and duplicate code needlessly, and there is already more than enough code duplication in there already.

Like I mentioned, it is paired up by functionality.  The vertex shaders are: null-v, which offers color/shading only; l*-v, which offers lighting; *e-v, which adds the env translation matrix; *n-v, which provides access to the tangent space data needed for normal maps; *f-v, which gives you fog support.  And the pairing is based on what the fragment shader needs.  So, the only special thing that lbgs-f needs is lighting, which means it only has to be paired up with l-v.  But lbgse-f needs envmap support too, so it is paired up with le-v which has access to the env translation matrix.

 

Offline ARSPR

  • Preys On Mantis
  • 29
Re: .sdr file question and Lighting Issues again
Like I mentioned, it is paired up by functionality.  The vertex shaders are: null-v, which offers color/shading only; l*-v, which offers lighting; *e-v, which adds the env translation matrix; *n-v, which provides access to the tangent space data needed for normal maps; *f-v, which gives you fog support.  And the pairing is based on what the fragment shader needs.  So, the only special thing that lbgs-f needs is lighting, which means it only has to be paired up with l-v.  But lbgse-f needs envmap support too, so it is paired up with le-v which has access to the env translation matrix.
Mercilessly plagiarized to wiki: http://www.hard-light.net/wiki/index.php/OpenGL_Shaders_(GLSL)#Description_of_shaders   :p

EDITED:

I've checked the used letter order in the Mediavp shader set and I've ordered the Wiki shader letters too. (I mean that you have lb shaders but not bl ones). Please check that it's OK.

OTOH, I've just noticed that there are no env shaders without spec. I've also checked in game (F3 lab) and indeed it seems that env is switched off whenever spec is off, (in both GLSL and legacy). Am I right? (I ask this in order to update Wiki -env help with a comment about needing -spec).
« Last Edit: March 08, 2009, 01:39:18 pm by ARSPR »
IF YOU HAVE TROUBLES WITH FS2:
  • Please, please, please, READ and UNDERSTAND the sticky threads in FreeSpace & FreeSpace Open Support board.
    A lot of people are willing to help you, but, as anyone can understand, seeing the very same "issues" repeated again and again can become quite depressing. Please, spend a bit of time trying to solve the issue by yourself.
    (Lobo deserves a monument).
  • Then, if you aren't still able to solve your issue, feel free to ask for help in that same board.
    FYI, most of the troubles are caused by wrong mod installations which lead to either missing data or undesired cross-effects between them. Always follow the mod installation instructions and keep a clean FS2 installation as explained in the sticky threads. Two additional links about how the game handles game data:
  • If you think that you've discovered a bug, mantis it.
    Provide as much info as you can, and try to narrow it down. A lonely "FS2 doesn't work" is not a good report.

Whoever Hanlon was: Never attribute to malice that which can be adequately explained by stupidity.
Albert Einstein: Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe.

Dell Dimension 9200 - Vista 32-bit Ultimate
Core 2 Quad Q6600 @2.4GHz - RAM 2 GB DDR2
nvidia 8800 GTX - Integrated Sigmatel Audio

 

Offline taylor

  • Super SCP/Linux Guru
  • 212
    • http://www.icculus.org/~taylor
Re: .sdr file question and Lighting Issues again
OTOH, I've just noticed that there are no env shaders without spec. I've also checked in game (F3 lab) and indeed it seems that env is switched off whenever spec is off, (in both GLSL and legacy). Am I right? (I ask this in order to update Wiki -env help with a comment about needing -spec).
Correct.  The env map is modulated against the spec map, so if there was no spec map then the env stuff would just look all wrong.  So -env does require the use of -spec for it to actually do anything.

 

Offline pecenipicek

  • Roast Chicken
  • 211
  • Powered by copious amounts of coffee and nicotine
    • Skype
    • Steam
    • Twitter
    • PeceniPicek's own deviantart page
Re: .sdr file question and Lighting Issues again
i'm mucking about with something, so the base cleanest shaders to play with should be l-v.sdr and lf-v.sdr?


also, what is the fog stuff used for exactly?
Skype: vrganjko
Ho, ho, ho, to the bottle I go
to heal my heart and drown my woe!
Rain may fall and wind may blow,
and many miles be still to go,
but under a tall tree I will lie!

The Apocalypse Project needs YOU! - recruiting info thread.

 

Offline ARSPR

  • Preys On Mantis
  • 29
Re: .sdr file question and Lighting Issues again
Correct.  The env map is modulated against the spec map, so if there was no spec map then the env stuff would just look all wrong.  So -env does require the use of -spec for it to actually do anything.

OK, Wiki updated.

Nevertheless, I thought that the spec map usage from env was optional. I thought that, despite of -spec setting, env was modulated in this way:
  • If there wasn't a -spec map, then a fixed hardcoded, (within shader or within game exe), amount of env was used.
  • If there was a -spec map with alpha channel, this value was used.
  • If there was a -spec map without alpha channel, the same fixed hardcoded amount was used.

So I thought that -env didn't need -spec flag. It just used the -spec map alpha channel info if available, despite the status of the specular effect itself.

Taylor, you've just posted that env DOES need spec. Could you explain if my other suppositions were right?

(I remember adding more or less this info to Texturing section in Wiki, so I would like to correct it if needed).
IF YOU HAVE TROUBLES WITH FS2:
  • Please, please, please, READ and UNDERSTAND the sticky threads in FreeSpace & FreeSpace Open Support board.
    A lot of people are willing to help you, but, as anyone can understand, seeing the very same "issues" repeated again and again can become quite depressing. Please, spend a bit of time trying to solve the issue by yourself.
    (Lobo deserves a monument).
  • Then, if you aren't still able to solve your issue, feel free to ask for help in that same board.
    FYI, most of the troubles are caused by wrong mod installations which lead to either missing data or undesired cross-effects between them. Always follow the mod installation instructions and keep a clean FS2 installation as explained in the sticky threads. Two additional links about how the game handles game data:
  • If you think that you've discovered a bug, mantis it.
    Provide as much info as you can, and try to narrow it down. A lonely "FS2 doesn't work" is not a good report.

Whoever Hanlon was: Never attribute to malice that which can be adequately explained by stupidity.
Albert Einstein: Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe.

Dell Dimension 9200 - Vista 32-bit Ultimate
Core 2 Quad Q6600 @2.4GHz - RAM 2 GB DDR2
nvidia 8800 GTX - Integrated Sigmatel Audio

  

Offline taylor

  • Super SCP/Linux Guru
  • 212
    • http://www.icculus.org/~taylor
Re: .sdr file question and Lighting Issues again
Quote
If there wasn't a -spec map, then a fixed hardcoded, (within shader or within game exe), amount of env was used.
Nope, it requires the spec map.  Without that it doesn't have any way to tell how to properly blend the env map onto the model.  If env was applied without the spec map then it would have to be modulated against the diffuse map.  In such a case you end up with something where it was really shiny all over the model, but with practically no env on the cockpit glass.  And how shiny the model would be is tied directly to the color of the model, so light colored models would be less shiny and dark colored models would be more shiny.  There just isn't a way to make it look remotely decent in other words.  It must be modulated against a map which was specifically designed for that purpose.

Quote
If there was a -spec map with alpha channel, this value was used.
If there was a -spec map without alpha channel, the same fixed hardcoded amount was used.
Correct on the first count but not on the second.  If the spec map doesn't have an alpha channel then it is modulated against the RGB values of the spec map, so it's not some fixed/hardcoded amount in the code or shaders.

 

Offline chief1983

  • Still lacks a custom title
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: .sdr file question and Lighting Issues again
This thread is made of cookies and bunnies and all things win.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline ARSPR

  • Preys On Mantis
  • 29
Re: .sdr file question and Lighting Issues again
Just to be sure that I've understood before updating the wiki :nervous: :nervous: :
  • If there's no -spec map then there's no env effect.
  • If there's a -spec map with alpha channel. This channel value is used for the env effect. Are -spec map RGB values used in any way?
  • If there's a -spec map without alpha channel. RGB values are used for the env effect. I suppose the env amount depends on the luminosity/luminance however you define it. I mean from the RGB data, you obtain L of an equivalent "HSL-ish" space. Am I right?

OTOH, and this is maybe a feature request rather than any other thing, and possibly it's worthless (too much work for nearly nothing). Env effect seems fully independent from spec one. Env just uses -spec maps, (in a different/complementary way than the spec effect). So would it be possible to make them fully independent? I mean that env effect didn't need -spec flag to work.
IF YOU HAVE TROUBLES WITH FS2:
  • Please, please, please, READ and UNDERSTAND the sticky threads in FreeSpace & FreeSpace Open Support board.
    A lot of people are willing to help you, but, as anyone can understand, seeing the very same "issues" repeated again and again can become quite depressing. Please, spend a bit of time trying to solve the issue by yourself.
    (Lobo deserves a monument).
  • Then, if you aren't still able to solve your issue, feel free to ask for help in that same board.
    FYI, most of the troubles are caused by wrong mod installations which lead to either missing data or undesired cross-effects between them. Always follow the mod installation instructions and keep a clean FS2 installation as explained in the sticky threads. Two additional links about how the game handles game data:
  • If you think that you've discovered a bug, mantis it.
    Provide as much info as you can, and try to narrow it down. A lonely "FS2 doesn't work" is not a good report.

Whoever Hanlon was: Never attribute to malice that which can be adequately explained by stupidity.
Albert Einstein: Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe.

Dell Dimension 9200 - Vista 32-bit Ultimate
Core 2 Quad Q6600 @2.4GHz - RAM 2 GB DDR2
nvidia 8800 GTX - Integrated Sigmatel Audio

 

Offline taylor

  • Super SCP/Linux Guru
  • 212
    • http://www.icculus.org/~taylor
Re: .sdr file question and Lighting Issues again
Quote
If there's no -spec map then there's no env effect.
Correct.

Quote
If there's a -spec map with alpha channel. This channel value is used for the env effect. Are -spec map RGB values used in any way?
Correct.  Spec map RGB values will always be used for the specular light addition, and if there is alpha in the spec map then the alpha is used for the envmap blending.

Quote
If there's a -spec map without alpha channel. RGB values are used for the env effect. I suppose the env amount depends on the luminosity/luminance however you define it. I mean from the RGB data, you obtain L of an equivalent "HSL-ish" space. Am I right?
Pretty much, yeah.  The math is literally: color = env * spec.

Quote
OTOH, and this is maybe a feature request rather than any other thing, and possibly it's worthless (too much work for nearly nothing). Env effect seems fully independent from spec one. Env just uses -spec maps, (in a different/complementary way than the spec effect). So would it be possible to make them fully independent? I mean that env effect didn't need -spec flag to work.
That would make sense of course, and would probably just involve a single line change to do, it just hasn't ever been done.

 

Offline ARSPR

  • Preys On Mantis
  • 29
Re: .sdr file question and Lighting Issues again
Quote
If there's a -spec map with alpha channel. This channel value is used for the env effect. Are -spec map RGB values used in any way?
Correct.  Spec map RGB values will always be used for the specular light addition, and if there is alpha in the spec map then the alpha is used for the envmap blending.
Sorry if I seem to be dumb...

What I wanted to ask was if env effect used -spec map RGB values when an alpha channel is present. Or whether in this situation, it only uses this last channel info. (I DO know that specular effect uses -spec map RGB values, despite env or no env.  :D).
IF YOU HAVE TROUBLES WITH FS2:
  • Please, please, please, READ and UNDERSTAND the sticky threads in FreeSpace & FreeSpace Open Support board.
    A lot of people are willing to help you, but, as anyone can understand, seeing the very same "issues" repeated again and again can become quite depressing. Please, spend a bit of time trying to solve the issue by yourself.
    (Lobo deserves a monument).
  • Then, if you aren't still able to solve your issue, feel free to ask for help in that same board.
    FYI, most of the troubles are caused by wrong mod installations which lead to either missing data or undesired cross-effects between them. Always follow the mod installation instructions and keep a clean FS2 installation as explained in the sticky threads. Two additional links about how the game handles game data:
  • If you think that you've discovered a bug, mantis it.
    Provide as much info as you can, and try to narrow it down. A lonely "FS2 doesn't work" is not a good report.

Whoever Hanlon was: Never attribute to malice that which can be adequately explained by stupidity.
Albert Einstein: Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe.

Dell Dimension 9200 - Vista 32-bit Ultimate
Core 2 Quad Q6600 @2.4GHz - RAM 2 GB DDR2
nvidia 8800 GTX - Integrated Sigmatel Audio

 

Offline pecenipicek

  • Roast Chicken
  • 211
  • Powered by copious amounts of coffee and nicotine
    • Skype
    • Steam
    • Twitter
    • PeceniPicek's own deviantart page
Re: .sdr file question and Lighting Issues again
why am i being ignored?

:p

Quote
i'm mucking about with something, so the base cleanest shaders to play with should be l-v.sdr and lf-v.sdr?


also, what is the fog stuff used for exactly?
Skype: vrganjko
Ho, ho, ho, to the bottle I go
to heal my heart and drown my woe!
Rain may fall and wind may blow,
and many miles be still to go,
but under a tall tree I will lie!

The Apocalypse Project needs YOU! - recruiting info thread.

 

Offline taylor

  • Super SCP/Linux Guru
  • 212
    • http://www.icculus.org/~taylor
Re: .sdr file question and Lighting Issues again
What I wanted to ask was if env effect used -spec map RGB values when an alpha channel is present. Or whether in this situation, it only uses this last channel info. (I DO know that specular effect uses -spec map RGB values, despite env or no env.  :D).
I thought that was the answer, but it may be a bit too vague. :)

For the env map blending it will use from the spec map RGB or alpha (in the case that the spec map has an alpha channel).


why am i being ignored?
I thought that I answered you actually.  Guess I forgot though. :D

If by "cleanest" you mean the most simple, then that would be l-v.  There really isn't a whole lot different between l-v, le-v and lf-v though, as far as complexity goes.  But there really isn't a whole lot to do with the vertex shaders (since it's not very flexible without a material system).  If you want to play around with the light settings then that's where you would do it, but otherwise you would mostly just be wasting your time.  You can turn off some of the lights to get a good speed boost (if you dropped 2 or 3 lights out then you would probably get about a 40-50 FPS improvement on most models), but then you lose some visual effects in the process.  Most visual changes would come from changes to the fragment shaders, but like with the vertex shaders, you don't have a whole lot of room to play with it all without a material system in place.

And the fog stuff is for full nebula missions.  They aren't used otherwise.

 

Offline pecenipicek

  • Roast Chicken
  • 211
  • Powered by copious amounts of coffee and nicotine
    • Skype
    • Steam
    • Twitter
    • PeceniPicek's own deviantart page
Re: .sdr file question and Lighting Issues again
i'm looking for some base code to scroll through and modify, some yesterdays attempts were... rather unsuccesfull...



null-f.sdr would be considered the most basic fragment shader, right?
Skype: vrganjko
Ho, ho, ho, to the bottle I go
to heal my heart and drown my woe!
Rain may fall and wind may blow,
and many miles be still to go,
but under a tall tree I will lie!

The Apocalypse Project needs YOU! - recruiting info thread.