(08-15-2015, 10:58 PM)TheShyGuy Wrote: Yeah, it looks like it's an issue of the background's depth. The draw order doesn't necessarily matter since it's 3D, you're only drawing opaque objects, and you're not trying to optimize anything. Though, I don't know how GM handles 3D so I could be wrong about the draw order. You should check the docs to make sure it's doing what you think it is.
I think it might be the draw order. I had to check when i implemented the fog. The fog kept going over the whole screen, covering the background layer until i changed the order i drew the fog and backgrounds in. Whats weird this time is I had to spawn a separate object to draw the background graphic or else the ortho bit would negate all depth and 3d code. Weirder still is that it only works when i set the depth between 0 and 3. Certainly an odd case this one...
(08-15-2015, 10:57 PM)Mag Wrote: Looks like you're using Game Maker Studio by those function names.
If you want, you could use a shader to apply effects like distance fog and a static sky. I've made a photoshop shader pack that could serve as a bootstrap for making shaders in any game.
Here's a quick fog shader I cooked up just now (This would need to be applied on all objects that you want fog on, for :
Code://
// Fog Fragment
//
attribute vec3 in_Position;
attribute vec4 in_Colour;
attribute vec2 in_TextureCoord;
attribute vec3 in_Normal;
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
varying float depth;
float view_far = 10000.0;
float view_near = 1.0;
void main()
{
v_vColour = in_Colour;
v_vTexcoord = in_TextureCoord
vec4 object_space_pos = (rot * vec4(in_Position, 1.0)) + vec4(gamePosition, 0.0);
vec4 viewPos = gm_Matrices[MATRIX_WORLD_VIEW] * object_space_pos;
depth = (viewPos.z - view_near) / (view_far - view_near);
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
}
Gm 8, actually. I was using 8.1 and hated the room editor before they fixed it so i switched to 8.0. And now that studio is out i'm too far along to smoothly port over the engine, and the fact that the few people in my little dev group off site only work in 8.0 as well, and thus we couldn't share edits easily.
Tho I'll look into your suggestion, hopefully its 8.0 compatible.