Jump to content
The Dark Mod Forums

Wrong information on the Darkmod Wiki...


AluminumHaste

Recommended Posts

I was browsing the wiki (yes some people do read it lol) and I came across the guide for making glass (Found here: Link). Now in this article the author states;

"The only downside is that you can't apply a normalmap or specular to the texture--if you do it becomes opaque."

This isn't entirely true, you can use normalmaps and spec maps, they just have to be at the end of the material file like so:

 

textures/darkmod/window/stained_glass_lion
{
noSelfShadow
noshadows
twosided
glass
forceoverlays
sort decal
sort nearest

qer_editorimage textures/darkmod/window/lion_glass_editor
{
	vertexProgram heatHaze.vfp
	vertexParm  0  0 , 0  // texture scrolling
	vertexParm  1  .5  // magnitude of the distortion

	fragmentProgram heatHaze.vfp
	fragmentMap 0  _currentRender
	fragmentMap 1  textures/darkmod/window/lion_glass_local // the normal map for distortion
}

{
	blend gl_dst_alpha, gl_one
	maskalpha
	cubeMap env/gen2
	red	 Parm0
	green   Parm1
	blue	Parm2
	texgen  reflect
}
{
	blend filter
	map textures/darkmod/window/lion_glass_d
}
bumpmap textures/darkmod/window/lion_glass_local
specularmap textures/darkmod/window/lion_glass_s
}

 

And there is a difference if you take out (or comment out) the bumpmap stage as shown in these pics.

 

This is WITHOUT the bumpmap stage

glassnonormalmapgn1.jpg

 

This is WITH the bumpmap stage

glasswithnormalmapzi1.jpg

 

As you can see there is a big difference. Also don't pay attention to the FPS counter, it was running slow because I also had DarkRadiant open in the background and I'm running at 1920x1200 with 8x Antialiasing, and when it takes screenshots the counter is really low. Just wanted to let people know.

I always assumed I'd taste like boot leather.

 

Link to comment
Share on other sites

Well, you're using a lot more keywords in your shader than I was, but I know that adding bumpmaps or speculars to the example I was using (no fragment shader, and just a simple blend add/filter keyword) was not possible (even when added to the end).

 

It's possible one of those keywords has some impact on how the blending works. How transparent is your glass in that example if you remove the vertex shader and cubemap?

Link to comment
Share on other sites

Okay I removed what you asked so my material file looks like this:

 

textures/darkmod/window/stained_glass_lion
{
noSelfShadow
noshadows
twosided

glass
forceoverlays
sort decal
sort nearest

qer_editorimage textures/darkmod/window/lion_glass_editor

{
	blend filter
	map textures/darkmod/window/lion_glass_d
}
bumpmap textures/darkmod/window/lion_glass_local
specularmap textures/darkmod/window/lion_glass_s
}

 

And this is the result:

 

shot00030vf4.jpg

 

As you can see, Springheel was right, without the cubemap and vertex shader the texture is no longer translucent and becomes opaque. So those will be required.

I always assumed I'd taste like boot leather.

 

Link to comment
Share on other sites

I was playing around with the editor some more, and found that at high angles the bumpmap looks even better. Take a look.

 

shot00035uj3.jpg

 

there's no light coming from the inside, it's only being lit by one light (which could be substituted for a skybox) and looks realistic. Without the bumpmap I don't think you would see much if anything at all at that angle.

Edited by AluminumHaste

I always assumed I'd taste like boot leather.

 

Link to comment
Share on other sites

It's entirely possible to have lighting passes (diffuse, specular, bumpmaps) on translucent surfaces. However, there are some important caveats to be aware of. First off, stencil shadows require use of the depth buffer, so translucent surfaces cannot receive shadows. Also, all lighting passes are additive, and they are executed before all other render passes (so the filter stage is actually being executed after the lighting, and is reducing its brightness - it's misleading to put the diffuse/specular/bumpmaps after the other render stages in your material).

Link to comment
Share on other sites

It's entirely possible to have lighting passes (diffuse, specular, bumpmaps) on translucent surfaces. However, there are some important caveats to be aware of. First off, stencil shadows require use of the depth buffer, so translucent surfaces cannot receive shadows. Also, all lighting passes are additive, and they are executed before all other render passes (so the filter stage is actually being executed after the lighting, and is reducing its brightness - it's misleading to put the diffuse/specular/bumpmaps after the other render stages in your material).

 

Thank you, very informative post :) But that's fine, I don't expect it to be a problem to not have shadows.

I always assumed I'd taste like boot leather.

 

Link to comment
Share on other sites

It's entirely possible to have lighting passes (diffuse, specular, bumpmaps) on translucent surfaces.

 

So how would you do it with the following shader?

 

textures/darkmod/metal/flat/lamp_glass_lit_transparent	 //glass is partially transparent
{
glass
noshadows

{
	blend   add 
	map	models/darkmod/props/textures/lamp_glass_lit
	rgb 1
 }
}

Link to comment
Share on other sites

If you want just a simple translucent surface that uses lighting passes and nothing else, then the following would suffice:

textures/darkmod/glass/flat/lamp_glass_lit_transparent
{
glass // doesn't affect appearance, only affects impact sounds
translucent // avoids implicit opaque black stage used for filling the depth buffer
twoSided // also implies noShadows

diffusemap models/darkmod/props/textures/lamp_glass_lit
// you could also include a specularmap and bumpmap
}

Again, keep in mind that the glass won't receive shadows, and each side will only be hit by light coming from that side (if you have a single light, one side of the glass will be bright and the other will be completely dark), unless the light is ambient.

 

I think you're able to get away without using the 'translucent' keyword in that shader because it has no lighting passes (and perhaps because the first render pass uses additive blending). Also, if you'll forgive me nitpicking, "rgb 1" is does nothing (using values other than 1 would darken/brighten the image).

Link to comment
Share on other sites

You're right, adding the translucent keyword allows you to add specular and bumpmaps (though if you don't use an additive filter on the texture it becomes totally invisible. :) )

Link to comment
Share on other sites

I would assume only totally invisible on the side that's facing away from the light. (since the side is facing away from the light, it receives no lighting and thus doesn't modify what's on the screen, making it invisible) But yeah... I'd be tempted to add another stage, either additive or multiplicative (aka filter blending), depending on the situation (I'd probably use additive for casings for lights that are turned on, and multiplicative for things like windows away from lights). Just be aware that additive and alpha blending appear bright even if there's no nearby lights.

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

    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 6 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
    • nbohr1more

      Looks like the "Reverse April Fools" releases were too well hidden. Darkfate still hasn't acknowledge all the new releases. Did you play any of the new April Fools missions?
      · 5 replies
×
×
  • Create New...