Jump to content

Fog


Recommended Posts

So I was searching of a way of implementing fog, something like silent hill effect, greatly educed visibilty of all object that are a little away from player.

The options I found out would be using the clouds that show up when you zoom out, or using other screenwide widget with transparent imge.

Thats why I was asking about shaders to add grain to it all and stuff like that.

 

Any other ideas/options on this subject?

 

PeterA

I want to add fog like in silent hill for example.

Is there a way of making custom shaders? Or other way that I can make fog effect?

 

Edited by _Q_
Link to comment
Share on other sites

A low tech solution could be that you create three or so screen overlays for the player huds with a foggy looking texture and have them move around a little, independently of one another.

 

With the current cloud thing on overlay one is enough since its animated, I think I can make it appear slowly with changing it alpha value over some time, but that seems far from perfect.

Hawing the grain effect shader or maybe some other particle effect would look much better.

Link to comment
Share on other sites

  • Developer

Hey @_Q_, I don't know of any modders that have compiled their own shader, but the DS Mod Tools does ship with ShaderCompiler.exe on Windows (Steam\SteamApps\common\Don't Starve Mod Tools\mod_tools\tools\bin).

 

I believe the command line parameters to compile a shader would be

ShaderCompiler.exe -little "creep" "PosUV_WorldPos.vs" "creep.ps" "creep.ksh" -oglsl

I believe you should be able to manually extract the .vs and .ps files from the .ksh files in data/shaders.

 

If you take a look at rain.lua or mistparticle.lua you can see an example of how to hook up a shader to a particle emitter.

 

 

Good luck, and let me know if you run into any problems.

 

Edit: I looked into it a little bit further and there doesn't appear to be a generic way to set shader constant parameters from lua. One possibility would be to do something similar to the effect in heatover.lua, and send your parameters in via SetEffectParams, which takes 4 floats.

Link to comment
Share on other sites

  • Developer

Yeah @_Q_, I think you could do some pretty neat stuff with replacing the postfx shaders. Some techniques will be a little bit difficult because you won't have access to change the shader inputs, but I definitely look forward to what you can come up with!

Link to comment
Share on other sites

Yeah @_Q_, I think you could do some pretty neat stuff with replacing the postfx shaders. Some techniques will be a little bit difficult because you won't have access to change the shader inputs, but I definitely look forward to what you can come up with!

 

The ShaderCompiler.exe wont run cause it has missng DLL files:

-missing cg.dll

 

What did You meant by manually extracting vertex and pixel shader files from ksh files?

I didn't find any extraction soft or commands, I may be missing something, its new stuff for me:D

 

Link to comment
Share on other sites

  • Developer

@_Q_, I've added the required dlls to the package now, so you should be able to run it now.

 

What I meant by manually extracting the vertex and pixel shader files, is if you open the .ksh file in a text editor, you should see the code and files names for both the vertex and pixel shader.

 

If you open anim.ksh, look for anim.vs, the vertex shader code will start 4 characters later with "uniform mat4 MatrixP;". Similarly further down you'll see anim.ps and the actual code starts with "#if defined( GL_ES )".

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...