3D island in Love2d: fog thoughts?
Posted: Sat Oct 24, 2015 2:11 am
Hi folks,
I'm planning on making my next game in a weird 3D view using large numbers of billboards. Imagine the rotating island in Yoshi's island and you're close - just 100% side-on. I've got plenty of experience and I think I can bend Love2d to my will.
The only thing I'm not sure about is how best to implement the depth-fog in the shader.
The shader will look at how far the object is from the camera and blend to a standard gradient I'll be using for the sky.
Fog changes with distance from the camera. This 'z' component will be my own creation (i.e. not something the shader knows about), and something I'll have to pass in to the shader somehow. However, I don't ideally want to have to pass in a different Z with every object as that might well create a rather horrific performance hit. Does anyone have any suggestions on how I can feed a shader this information in a slightly friendlier way?
Shaders aren't my strong suit. Spellrazor is an exception - everything I did there was kind of easy.
Edit: Never mind. I've added a love file here: http://www.mediafire.com/download/91rr5 ... sland.love
I'm an idiot. If I'm using buckets to sort, as I do here, I can use the drawing of those bucket-levels as opportunities to change colour, which is already sent to the shader and can be interpreted however I want. It's not super-fast, but it might do.
I'm planning on making my next game in a weird 3D view using large numbers of billboards. Imagine the rotating island in Yoshi's island and you're close - just 100% side-on. I've got plenty of experience and I think I can bend Love2d to my will.
The only thing I'm not sure about is how best to implement the depth-fog in the shader.
The shader will look at how far the object is from the camera and blend to a standard gradient I'll be using for the sky.
Fog changes with distance from the camera. This 'z' component will be my own creation (i.e. not something the shader knows about), and something I'll have to pass in to the shader somehow. However, I don't ideally want to have to pass in a different Z with every object as that might well create a rather horrific performance hit. Does anyone have any suggestions on how I can feed a shader this information in a slightly friendlier way?
Shaders aren't my strong suit. Spellrazor is an exception - everything I did there was kind of easy.
Edit: Never mind. I've added a love file here: http://www.mediafire.com/download/91rr5 ... sland.love
I'm an idiot. If I'm using buckets to sort, as I do here, I can use the drawing of those bucket-levels as opportunities to change colour, which is already sent to the shader and can be interpreted however I want. It's not super-fast, but it might do.