Some progress (added new vid)

Published February 22, 2017
Advertisement

Making some decent progress on the game over the last few days.

First up, I implemented a billboard-based particle system, used for the torch effect in the video above. It uses the following sprite atlas that I stole from the internet somewhere and generates a dynamic vertex buffer each frame. Since I only need a position and a texture coordinate in the vertex structure, I decided to use triangle lists rather than indexed buffers for this case and it performs pretty well.

fireatlas.png

Next up, I've started work on implementing shadow mapping from an omni-directional point light. This uses the usual method of rendering depth into a texture cube then projecting this onto the scene. Here's one face of the texture cube, false coloured but you get the idea.

image0.png

I'm actually using D3DFMT_R32F format for the first time. I have previously used D3DFMT_A8R8G8B8 and packed/unpacked the depth into the colour channels but I've noticed I seem to get much better results using a floating point texture format and I believe this is supported pretty much everywhere now.

The video is using a cube map of dimension 512x512 and currently no PCF or filtering of any kind and looks okay. Some quick and dirty experiments suggest I can happily render eight shadow cubes a frame without dropping below 60 fps on my mid-range laptop, so I'm hoping that I can finally crack multiple point-light shadowing and lighting in this game.

The approach I want to take with multiple point lights is to have a consistent shadow colour and a consistent lit colour across the screen i.e. each shadowed pixel should be the same level of darkness and each visible pixel should be as if it has only been lit once.

I'm thinking vaguely about doing a first pass drawing everything as if it is in shadow, then clearing the z-buffer and doing a pass for each light where the pixel shader first tests to see if it is in shadow and discards the pixel if so. I'm not yet sure how to solve the "light once" problem for the pixels that are not in shadow, but plan to experiment to see if this is possible.

Anyway, that's all for now. Not a very technical entry and not like me to post no code, but there is nothing very interesting behind any of this in terms of C++ so we'll leave this here.

Thanks for stopping by.

[EDIT] I was asked by a non-technical friend how the fire effect worked so made the below video, not really aimed at you lot as you already understand billboard particle systems, I'm sure :)

Thought I'd stick it in here for posterity anyway. It's also on my Facebook. You never know, might manage to engage the interest of at least one non-programmer, weird bunch though they are :)

6 likes 2 comments

Comments

Awoken

So you're actually coding the lighting yourself?! That is really impressive.

February 22, 2017 09:31 PM
Aardvajk

So you're actually coding the lighting yourself?! That is really impressive.


It's just standard cube-map-based shadow mapping. But thank you :) Yes, this is all just using vanilla Direct3D 9 with a bit of D3DX support for texture loading and stuff.
February 23, 2017 06:57 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement