Jump to content
The Dark Mod Forums

water reflection + refraction


ungoliant

Recommended Posts

yeah if theres an alphatest option that displays only alpha elements above a certain "perentage" of the original values..... then there has to be some sort of gradient transparency. As for blend blend operation, as I understand it, doesn't that just overlay (or add to, or multiply, or something) one image on top of the other???? if that is the case, why not blend blend a diffusemap of the grass with gradient transparency on top of the dirt that is opaque?

Link to comment
Share on other sites

The lighting goes 'wrong' - that is, the result does not respond to local light, eg, if you shine the player lantern on it then it remains dark compared to the surrounding or if you extinguish a torch then the surface glows in the dark.

Link to comment
Share on other sites

ok back to reflection. More problems. I'm using a new reflective patch in my map textured with the same reflective material used in the skybox. The result is..... confounding. So heres some properties of the new reflection as viewed in my new patch.

 

1) it doesn't reflect anything accurately from the patch itself. In fact it doesn't really reflect at all. Instead......

 

2) it looks at first glance like its just showing portal_sky

 

3) the patch surface gets darker as you move away from it

 

4) the "skybox" shown on the patch surface shows the reflected moonlight on the water surface, but not the moon itself, the stars, or the clouds.

 

5) when the patch is viewed overlaying real portal_sky texture, it matches up perfectly except for the things listed above.

 

OK, so then I decided this crap is F'd up beyond belief, so I'm just going to create a new shader thats an exact copy of my original reflective surface, texture the patch with that new shader instead, and see if I could convince D3 to create a new buffer with mirrorRenderMap based on the player camera instead of the skybox camera. The result was even more F'd up. It basically displayed the same thing as before, except when I back up about 20-30 feet it overlayed the reflection of nearby surfaces at a strange angle on top of the original effect?!?!?

 

Seriously, wth. Is this D3 trying to punish me for trying to use mirrorRenderMap with both the skybox camera and the player camera? Am I doing something wrong?? Here is the material def:

 

textures/water_source/black_underlay
{
nonsolid
noshadows
noselfshadow
water

diffusemap _black
{
	blend	blend
	mirrorRenderMap	512	512
	translate	0.5, 0.5
	scale		0.5, 0.5

	program	fresnel.vfp
	vertexParm	0	.5
	fragmentMap	0	_scratch
	alpha 0.6
}	
}

 

its labeled as "black" and uses diffusemap _black because I was having transparency issues with the water for a long time, even without the translucent keyword.

Link to comment
Share on other sites

Sorry I can't help you with your problem, but this caught my eye:

 

 

textures/water_source/black_underlay
{
nonsolid
noshadows
noselfshadow
water

diffusemap _black
{
	blend	blend
	mirrorRenderMap	512	512
	translate	0.5, 0.5
	scale		0.5, 0.5

	program	fresnel.vfp
	vertexParm	0	.5
	fragmentMap	0	_scratch
	alpha 0.6

 

HERE! :) Does this mean if we create a "dummy" vertex shader which does nothing but give back the original vertexes, we can pass an alpha value to it? And maybe even "alpha parm3" so we can modify the alpha in realtime? Wow, that would be awesome.

 

Does anybody have a listing of some example vertex programs so one could try this?

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

I wont claim to have a clue but I've been going over this 2 part tutorial over and over again to try to glean some insight:

 

Part 1

 

Part 2

 

And if that is too remedial, you could try poking around in Sikkpin's Shader pack:

 

Shader Pack

 

Or perhaps rebb or JC Denton will chime in??? :)

Edited by nbohr1more

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

ok, so i've not been working on this latest little TDM project for a few days as I found a temp job, put in some 10 hour days, and after a much needed breather from TDM, I've returned to this issue with some much needed vigor. First up:

 

Does this mean if we create a "dummy" vertex shader which does nothing but give back the original vertexes, we can pass an alpha value to it? And maybe even "alpha parm3" so we can modify the alpha in realtime? Wow, that would be awesome.

 

if you're referring to the alpha 0.6 value I passed in there, this was a very weak attempt in my noobness at manipulating transparency with textures. I played with it some more today, and it does absolutely nothing in this context. I deleted it.

 

On to current business. I've been playing a lot more with how the heathaze + fresnel VPs and the mirrorRenderMap stage keyword work, individually and together. Particular problems seem to arise from using mirrorRenderMap both in the skybox (from the skybox camera) and inside the map itself (from the player camera) at the same time.

 

here is a standard square patch standing straight up facing the player. It is textured with the black_underlay texture described in previous posts, and it is reflective. Keep in mind, this same texture is used in the in the skybox(in the water), so I guess theoretically this shader needs to (SHOULD) create 2 buffers, one from the player camera, and one from the skybox camera. Here is the result:

 

th_skybox_with_mirror.jpg

 

Minus all the dirt and rocks and crap, everything displayed here resides in the skybox. On the left side we view portal_sky. on the right side, black_underlay and its reflective surface. The left side displays normally. The water is made up of a twosided translucent texture with a dark gray diffuse map and its corresponding bumpmap (in the skybox). about 1 unit below is black_underlay, the same texture used in the right side patch. Above is just the twinkle stars, the square brush with the moon, and the cloud textures. In this SS I believe portal_sky on the left displays normal. On the right, the patch does not actually use portal_sky, instead I think it shows only the portion that is in the currently used in the mirrorRenderMap buffer (the water). The black stuff above I think just renders the diffusemap of the texture which is just _black (hence black_underlay). Also, you can see that the patch side is darker, and this I have determined is caused by the fresnel VP, which I'll get into later.

 

Second SS: Same thing, but with the reflective portion of the water surface deleted from the skybox. So now, only the player camera needs a buffer for mirrorRenderMap. Result:

 

th_skybox_no_mirror.jpg

 

Notice, in this SS the reflection displays "properly" minus 1 detail. You can see the player reflection, some big rocks, but above that..... the portal_sky texture behind the player is not reflected. Instead, this portion of the reflection just shows through tranparently to the portal_sky texture in front of the player (notice the seamless cloud displayed between the left and right side). So heres the first part where I need help. is there any possible way to reflect the portal_sky texture? Because I'm pretty sure that mirrorRenderMap is just not going to do it.

 

This post is quite long enough already. I'll post part 2 with the fresnel and heathaze issues later. If you know anything about creating seperate buffers for mirroring, or about reflecting a portal_sky texture, please add your 2 cents.

Link to comment
Share on other sites

From what I understand mirrorRenderMap and post process effects like heathaze both write to a texture called _scratch. You can apply _scratch to a brush and place it in that area to get a better idea what the engine is doing.

 

Your best bet here is probably to forgo using mirrorRenderMap in favor of a cube map. You can create one comprised of six screen shots easily with the envshot console command. No manual image editing necessary.

Link to comment
Share on other sites

this thought has already passed through my head. In fact, I think I'm going to be a bit dirty about it, keep the skybox, make a cube map out of it, and apply the cube map to the rolling waves coming into the shore, and still keep most of the ocean as portal_sky. If I do it right, and put a heat haze patch over it, hopefully noone will know the difference. Only problem is that the reflections, fake or otherwise, are always flat. I wonder if I can even make a rolling wave reflecting a cube map look good.

 

On the other hand, if i apply the fresnel VP to the cubemapped surface under the heat haze water textured patch above, and then somehow get the top layer to scroll backwards at the same pace that the wave moves forward, the wave might look virtually opaque until it gets close to shore, the movement would look good, and then reflect better as it gets close to shore. that might work. but that will be for monday night, I'm off to the island for the 4th!

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

    • nbohr1more

      The FAQ wiki is almost a proper FAQ now. Probably need to spin-off a bunch of the "remedies" for playing older TDM versions into their own article.
      · 1 reply
    • nbohr1more

      Was checking out old translation packs and decided to fire up TDM 1.07. Rightful Property with sub-20 FPS areas yay! ( same areas run at 180FPS with cranked eye candy on 2.12 )
      · 3 replies
    • taffernicus

      i am so euphoric to see new FMs keep coming out and I am keen to try it out in my leisure time, then suddenly my PC is spouting a couple of S.M.A.R.T errors...
      tbf i cannot afford myself to miss my network emulator image file&progress, important ebooks, hyper-v checkpoint & hyper-v export and the precious thief & TDM gamesaves. Don't fall yourself into & lay your hands on crappy SSD
       
      · 7 replies
    • 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.
      · 7 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
×
×
  • Create New...