Custom Fog Shader?

… and all that without the m_ prefix :wink: Its only in the j3md/frag/vert

OK… running into some problems :frowning:



I’ve added FogColor and FogDensity to my FogUnshaded.j3md “Material Parameters” (and I set them via the code). However, how do I properly reference those in my .frag file? It keeps telling me my values are “Undeclared Identifiers”… I don’t see how the other Material Parameters are referenced – since they are called “Color” and “ColorMap”… but yet in the .frag, they are m_Color and m_ColorMap… calling my .frag variables m_FogColor etc. doesn’t seem to do the trick?



EDIT: WAIT IT IS WORKING NOW :smiley: :smiley: I just didn’t put the “m_” prefix in all the variable locations, I just put it in the “uniform” declaration… ooooooo I like this :smiley: :smiley:

See my post above.

wow! 3 posts at the same minute :o. Those guys are very fast :).

Very fast and effective :wink: I was worried I was going to be told “wait for Shader Injectors”… instead, I have full fog effects being implemeted in my game 8)

Just wanted to post the results of this thread – looking good! Thanks again :slight_smile:



http://i.imgur.com/B7ioG.png

1 Like

jme3 is awesome, eh? :wink:

I used OGRE3D to create 3069 (the prequel to 3079, of course):



http://sites.google.com/site/free3069/



… and I just hated every moment of OGRE3D. It sucked. I went back to 2D programming after that game.



… then I found JME3, and was like:



http://cdn2.holytaco.com/wp-content/uploads/images/2010/11/So_Much_Win.jpg

@phr00t care to enlighten, why it sucked? It was not a one stop solution, that’s why?

@nehon I was really waiting for the Forward Rendering process & Render Buckets tutorial for a long time. :slight_smile: Any idea when they will be posted?

@iamcreasy



Nothing seemed to be straighforward with OGRE3D… I felt like I was spending more time fighting the engine than implementing features. And yes, it only seemed to have low-level 3D rendering support – no octtrees / audio nodes / input controllers etc. etc. But hey, I’m sure there are many people who use it and love it, so each to their own.

it only seemed to have low-level 3D rendering support

That's precisely what it is. Just the rendering engine. Everything else, you have to write it one your own. But, there are a other bindings too. Like they have ogre4j (to use with Java), but their last update was on 2009.

@iamcreasy yeah, still have to do it, but time’s a bitch…

@nehon Eagerly waiting!! Its gonna be like, most advanced tutorial in the doc section :smiley:

Would it be possible to use this alongside the normal fog filter? I mean for billboard type quads you use this FogLighting shader, but for all the other objects you dont have to do it? A potential problem you see is that if you have many materials and a day/night cycle you really want to modify the fog colour dynamically meaning you have to edit the fog colour in every material used in the scene.



Getting rid of those edges around billboard image type quads is really the last bit to make my “fantasy world” look perfect. :slight_smile:

@johncl – yeah, I need to update the fog color dynamically for all my materials when the day/night shift happens. It was a minor pain… but once the code was there to do it, I forgot about it :smiley:

@johncl – yeah, I need to update the fog color dynamically for all my materials when the day/night shift happens. It was a minor pain… but once the code was there to do it, I forgot about it :smiley:

I re-read the thread and see that I cant use it anyway as I am using the post water filter which would be unaffected by this. Unless someone also makes the same fog lines of the shader work in that post processor as well? :smiley:



Btw, does anyone have the foglighting.j3md file readily available? I havent tried making my own yet… but I guess I need to learn that too some day. :slight_smile:

@pspeed , may I use your code for my LightBlow shader? I already have a task for it: http://code.google.com/p/jme-glsl-shaders/issues/detail?id=3