Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 09 Feb 2003
Offline Last Active Dec 23 2015 03:42 PM

Topics I've Started

Variance Shadow Mapping With Expensive Terrain

15 October 2015 - 09:56 PM

Looking for some advice on shadow mapping algorithms. Currently working on this game, shadowing is a very important visual effect for the planet-based levels. I recently implemented variance shadow mapping with cascaded shadow maps. To my dismay I'm struggling with some awful visual artifacts: I believe the primary cause of this is that I'm not rendering the terrain into the shadow map. While I've found some ways to mask these effects, I have not found a silver bullet and the shadows are often detracting from the visual fidelity of the planet.


The terrain is generated from a ridiculous fractal noise equation, thus actually drawing the terrain into the shadow maps is impractically expensive. I suspect due to these issues VSM is ill-suited for my game. Are there similar soft shadow mapping approaches that do not require drawing the terrain into the shadow map that might be better choices?

Starfighter Alpha Video Preview

16 December 2013 - 10:11 AM

Here's a video showing a preview of the alpha version of my game in development: Starfighter. There's some cool stuff at the end around :40 (boss and planetary warp effect), so if you get bored it's still worth jumping to that part.


Feedback is appreciated, as always!



Is it possible to relief map a fractal surface

25 May 2013 - 10:31 AM

I'm fairly pleased with my terrain LOD and shading now overall, but I think the surface looks kind of flat; all I'm doing now is some simple normal mapping. I've been considering applying the relief mapping algorithm I use elsewhere, but it seems that would require huge numbers of texture fetches.


With the high-detail fractal surface I'm currently using, I'm already doing 33 texture fetches per pixel with the fractal algorithm alone (11 bands with a anti-repetition algorithm that requires 3 lookups per band), and I'm worried that multiplying this by a large number of search iterations (10 or so) for relief mapping it might choke the GPU.


At what point will I be texture-fetch limited? Do I have better options than simple normal mapping with a high-texture-fetch fractal noise-based surface?



Bizarre Terrain Glitch

23 May 2013 - 07:55 PM

I have a planet terrain shader that perturbs vertex positions by using a 3D fractal noise lookup on a sphere as the heightmap. It works perfectly 99.9% of the time except for these bizarre glitch vertices that occasionally appear. It looks like a spike in the middle of the otherwise normal mesh.


I've narrowed it down to the trilinear texture lookups into the noise. The glitch always only affects a single vertex, smaller than a texel in size. It occurs consistently for the same position lookup in the texture


Annoyingly, my fractal lookup is pretty basic and after looking over this code and trying dozens of things I remain stumped to the cause. I suspect the problem must be some sort of glitch in the vertex shader trilinear filtering; I see few other possibilities at this point. Anyway, here's some pics of the glitch and the relevant code for the vertex shader (I omit the pixel shader for brevity).


#define textureSize 80.0
#define halfTexelSize 0.00625
#define texelSize 0.0125

texture NoiseRealVertex;
sampler3D NoiseRealVertexSampler = sampler_state {
    Texture = <NoiseRealVertex>;
	AddressU = WRAP;
	AddressV = WRAP;
	AddressW = WRAP;
	MinFilter = Point;
	MagFilter = Point;
	MipFilter = Point;

// Vertex Noise Functions
float4 tex3D_trilinear(float3 t) 
	t -= halfTexelSize.xxx;
	float3 f = frac(t * textureSize);
	float4 x = float4(t, 0);

	float4 t000 = tex3Dlod(NoiseRealVertexSampler, x);
	float4 t100 = tex3Dlod(NoiseRealVertexSampler, x + float4(texelSize, 0, 0, 0)); 
	float4 t010 = tex3Dlod(NoiseRealVertexSampler, x + float4(0, texelSize, 0, 0)); 
	float4 t110 = tex3Dlod(NoiseRealVertexSampler, x + float4(texelSize, texelSize, 0, 0)); 
	float4 t001 = tex3Dlod(NoiseRealVertexSampler, x + float4(0, 0, texelSize, 0)); 
	float4 t101 = tex3Dlod(NoiseRealVertexSampler, x + float4(texelSize, 0, texelSize, 0)); 
	float4 t011 = tex3Dlod(NoiseRealVertexSampler, x + float4(0, texelSize, texelSize, 0)); 
	float4 t111 = tex3Dlod(NoiseRealVertexSampler, x + float4(texelSize, texelSize, texelSize, 0)); 

	return lerp(
			lerp(t000, t100, f.x), 
			lerp(t010, t110, f.x),
			lerp(t001, t101, f.x), 
			lerp(t011, t111, f.x),
	, f.z);

What should this gun shoot?

14 April 2013 - 01:28 PM

I built in some robust animation and targeting for the cannons on the large destroyer ship. This works quite and looks great, however, I seem to have developed the gamedev equivalent of writer's block and can't decide what kind of ordinance they should shoot!


While I could just regurgitate one of the existing weapons in my game (laser, plasma, rockets), I think it's about time to introduce something new... but I can't figure out what. These guns are some pretty big cannons. What do you think they should shoot?


Not sure if this helps, but I'm currently leaning towards a plot something along the lines of the player is a space privateer on a mission to disable and steal something from the mile-long imperial destroyer (the big ship with the cannons), but comes only to find it's already under attack by an alien force.


Additionally, part of the conundrum is since these guns are huge (the barrel is bigger than the player ship) presumably they must shoot something pretty powerful, likely meaning instant death if they shoot the player. In that case, can they be easily avoided like the easily dodgable, but powerful rockets that some of the smaller ships shoot? Do they take a long time between shots? Or do they simply not target the player most of the time? Maybe they just focus on the aliens?


Perhaps another annoyance with these cannons is if the player gets too close the barrel will swing around and smack the player ship. Think it should stop trying to target the player if you get too close? Or is it more realistic that the enemy using the cannon *would* try to smack the player with the cannon if you get too close?


Here's a screenshot of a battery of 3 of the cannons I'm talking about (there are 22 total, they are destructible):