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

    • Ansome

      Finally got my PC back from the shop after my SSD got corrupted a week ago and damaged my motherboard. Scary stuff, but thank goodness it happened right after two months of FM development instead of wiping all my work before I could release it. New SSD, repaired Motherboard and BIOS, and we're ready to start working on my second FM with some added version control in the cloud just to be safe!
      · 0 replies
    • 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
×
×
  • Create New...