Jump to content
The Dark Mod Forums

Ungoliant's mapping questions


ungoliant

Recommended Posts

The shader assumes that if the specular-multiplier ( your rgb 0.1 drives this ) value is below 0.1 ( floating point rounding error is probably causing your 0.11111etc value here ), that there is no specular-map at all and it then uses an artificial specular value instead, and not what you were actually supplying as your specular ( _white ). Afaik JCDenton introduced this so that everything has some specular to it.

 

It could be a rounding issue, but if that is the case, the problems start at a much lower value. I'm getting washed out issues starting at 0.001111, not 0.111111. after all the default value supplied is 0.1. So the acceptable tolerance on precision here is at least at the 1000's decimal place, and i have also seen it turn the snowblind effect on/off at .00111112 vs .00111111. My guess is that rounding is not an issue here.

 

And yes i'm going to try the scale thing, but i'm not very hopeful on it. I think serpentine replied about the randomness of using that technique a couple years back

Edited by ungoliant
Link to comment
Share on other sites

It was a typo, sorry. I meant 0.001.

 

The verdict remains the same.

 

Part of the shader in question :

 

SUB        R1, program.env[1], 0.001;  # See if there's a specular map for this material
CMP        R2, R1, .026, R2;        #  If not then give a constant artifical value as spec.

Link to comment
Share on other sites

yeah with that code snippet, I'm going to go ahead and assume you are correct on the rounding issue. So now issue is what the heck is this thing doing when "there's a specular map for this material"? Most of it looks like gobbledegook to me.

Link to comment
Share on other sites

And yes i'm going to try the scale thing, but i'm not very hopeful on it. I think serpentine replied about the randomness of using that technique a couple years back

 

There shouldn't be any randomness, it's a function that scales the color-data of an input image creating a new image in memory for the shader to use.

Link to comment
Share on other sites

yeah with that code snippet, I'm going to go ahead and assume you are correct on the rounding issue. So now issue is what the heck is this thing doing when "there's a specular map for this material"? Most of it looks like gobbledegook to me.

 

It simply uses the specularmap you provided.

 

Before this piece of code, the specularmap color has been read into R2.

 

CMP chooses between 2 values to assign to the output variable based on whether a certain parameter is less than 0.

Link to comment
Share on other sites

As mentioned, above 0.001 it starts mapping between specular power values.

 

0.002 maps to a very low powervalue. Low power values mean very broad specular highlights.

In the case of using _white as the specularmap this means you get a very broad and strong specular.

 

Note : Specular Power != Specular Strength/Intensity

 

It seems that JC Denton has disabled the actual use of the specular multiplier further down in the shader, which would normally cause the final specular to be toned down almost to invisible values when rgb 0.002 is used.

 

That could be re-enabled but may have impacts on other materials that have been authored since JCDenton introduced this shader.

Link to comment
Share on other sites

As mentioned, above 0.001 it starts mapping between specular power values.

 

0.002 maps to a very low powervalue. Low power values mean very broad specular highlights.

In the case of using _white as the specularmap this means you get a very broad and strong specular.

 

Note : Specular Power != Specular Strength/Intensity

 

It seems that JC Denton has disabled the actual use of the specular multiplier further down in the shader, which would normally cause the final specular to be toned down almost to invisible values when rgb 0.002 is used.

 

That could be re-enabled but may have impacts on other materials that have been authored since JCDenton introduced this shader.

well now you've officially lost me, my knowledge of specular contains nothing about power vs intensity. i guess i'll do some reading.

Link to comment
Share on other sites

Specular Intensity controls how much of the specular color arrives.

Specular Power controls the "size" of the highlight.

 

"Power" because in simple Specular Calculations a Power Function is used, maybe the term "Glossiness" or "Specular Exponent" makes more sense.

Link to comment
Share on other sites

Correction :

 

I was wrong on what actually maps the final power-values - the specular-power values are not based on the specular-multiplier but on the color of the specularmap.

 

So as it is now it looks like the specular multiplier is only ever used for the "is there a specularmap in the material" detection.

In the previous shader incarnations it was also used to multiply / color the final specular value down.

 

That means the problem ungoliant is seeing is because the rgb keyword is not doing what is expected when used in a specularmap stage in the material.

 

This also means that the suggestion of using the scale() image function will have the side-effect of broadening the highlight of the specular, since that is derived from the specular-image. Which is technically fine because that's the idea behind the shading system.

 

I don't know what the exact reasoning is behind disabling the multiplier, or how many materials may be affected where rgb-like keywords are used for the specular stages.

 

@SpringHeel :

 

Basically the "rgb" keyword in specular stages does not do what it does in default Doom3.

Glossiness and Strength come from the specularmap.

Link to comment
Share on other sites

As far as I understand the code and guessing that the rgb value in the material definition gets passed to the program.env[1] vector (is that correct? I don't know the specific part of the render code), it seems it is only there for deciding whether to use the specular or a default value. If the rgb value is smaller then 0.001, it doesn't get used. So it does not colorify the spec.

 

But it seems that the rgb value (again guessing this gets placed in program.env[0]) is used to colorify the specular.

 

This is very confusing :blink: .

 

Will see what happens if I change that.

 

@ungoliant, can you upload the pk4 where you've made the above shots here for comparision?

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

@ungoliant, can you upload the pk4 where you've made the above shots here for comparision?

its big. and its being overhauled into project form atm. and its supersquirrelsecretsortakinda. i think an easier route is to just make a room with a white light and a decal with texture: textures/darkmod/metal/grate/fence_iron_01. It looks worst when you are about the distance shown from the screenshot from a position tangent to the center of the decal. If you get up close and personal with the texture, it looks better, but not great. If you change the viewing angle, it starts to look a lot better as the decal gets closer to just being a thin line.

 

the rgb theory makes sense, and it doesn't make sense. how could it obtain a proper value when it makes the check for a specmap, but screw up when trying to display it?

Edited by ungoliant
Link to comment
Share on other sites

Thinking about it some more it should actually be fine to re-enable it but move the instruction into the right place first, so the shading stays in line with the whole "if something has a high specularmap value, assume that it is also more glossy" idea behind it.

 

# read specular map
TEX R2, fragment.texcoord[5], texture[5], 2D;

 

to

 

# read specular map
TEX R2, fragment.texcoord[5], texture[5], 2D;
MUL R2, R2, program.env[1];

 

But again, since this shader has been in place for so long, there is the possibility that this may affect other existing materials that have since been authored.

Link to comment
Share on other sites

alright so I did some more stuff. scale(_white, 0.1, 0.1, 0.1, 0.1) = error. leaving out alpha or changing alpha to anything else, still error. create 256x256 white tga, scale that instead. works. yields same result as map _white rgb 0.1. use white.tga with rgb keyword, same results as _white.

 

I dunno, maybe using _white, or any flat color for spec map just yields garbage looking stuff, and theres nothing you can do about it?

but that just can't be right, because when the interaction shader is turned to default and it assigns an arbitrary uniform spec value, it looks fine.... i dunno, i dont get it.

Link to comment
Share on other sites

I'm not sure what the actual problem is here, but why not just point the texture to a different shader, rather than using _white? We have dozens of metal material shaders.

Link to comment
Share on other sites

i dunno, you want me to run through all the stuff in TDM with _white specs and just change the values randomly? is the team going to implement that dirty fix to the mod? i guess i can just do it for my stuff, but people are going to run into that problem more than once. i'm sure its already happened and nobody commented on one weird overly bright spec past a certain distance in maps before. if there is a vfp fix that can make _white not look like garbage, its probably the best thing to do other than make spec maps for everything that is missing it. the problem is minor, admittedly, but real.

Link to comment
Share on other sites

There can't be very many textures using _white. Most textures don't even have specular stages...usually just metal.

Link to comment
Share on other sites

Glossiness and Strength come from the specularmap.

 

How does glossiness come from the specularmap? Strength comes from how white the pixels are, I get that. But doesn't glossiness have to do with the size of the highlight?

Link to comment
Share on other sites

Whoops I was wrong about something. I was looking at the wrong fencing during my last tests that were using vanilla textures, not the custom.

scale with a real image file works as intended. I can modify the values and it behaves as expected. Still doesn't look all that good though. using rgb with image file does not work at all.

 

I think it actually looks better to leave out the spec stage entirely and let the default values in interaction.vfp when it finds no specmap take over. Well, spread the word, using _white doesn't really work, and it sucks even if you use an image file and scale down the colors. just leave out the spec stage entirely if you don't have a spec map and don't feel like making one. thats my conclusion, but you guys can test it out for yourselves and see which way you think looks better.

 

I guess one thing we can take away from this is that if you want to ramp up or tone down your specmap, use scale and not rgb. There, something practical came out of this B)

Edited by ungoliant
Link to comment
Share on other sites

How does glossiness come from the specularmap? Strength comes from how white the pixels are, I get that. But doesn't glossiness have to do with the size of the highlight?

 

The "enhanced" interaction shader derives the glossiness part from the color-values of the specularmap, which were normally just driving the specular strength as you mentioned. The non "enhanced" shader does not do this and uses a preset gloss value instead.

Link to comment
Share on other sites

How does that work? Colour actually affects the colour of the highlight, but how does it affect the size?

Link to comment
Share on other sites

scripting issue.

the "call" spawnarg in a target_callscriptfunction entity states this:

The name of the global script function to call. If 'foreach' is 0(default), then it will be called with no arguments. Otherwise, the function will be called for each target entity of this entity, with the arguments like Function(target, activator, this);

I would like to use a target with my target_callscriptfunction, and be able to pass that target in the script that is being called by reference, but even with the tooltip, i cannot figure out how to do it. Can somebody give me an example of script syntax that will make this work?

 

Something like

myFunction(valuetype myTargetEntity)
{
 dostuffwith myTargetEntity;
}

i dunno... i'm a bit lost.

I don't know the value type of 'target', 'activator', or 'this', and i don't really want 'activator' or 'this'. Dont know how to assign the target i want to a parameter in the script function with a pass by reference.

Edited by ungoliant
Link to comment
Share on other sites

set "foreach" "1". The script function should look like

 

void myFunction(entity target,entity activator)
{
 dostuffwith target;
}

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

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.


  • Recent Status Updates

    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
×
×
  • Create New...