Would you like to react to this message? Create an account in a few clicks or log in to continue.

Slopes and Lighting

Go down

Slopes and Lighting Empty Slopes and Lighting

Post by Slaihne Sat Sep 17, 2011 5:25 am

Just a quick heads up on what i'm currently working on...

I decided that slopes / shaped blocks needs some attention.

I knew the basic technique was sound and it could be integrated well with the pixel light shaders.
But, i was never totally happy with three areas; lighting, collisions, and method of building.

Well, while i've been working on various bits and bobs i've had several ideas for each of the three and am currently implementing them.

The next release should have the following improvements.

Sloped terrain will be the only option.

Lighting will respect slopes. This means you can have triangular windows into your house if you want. It will also clean up the light in internal corners of buildings with the opposite external block empty.
I already have this working very well and am currently polishing it off. It also allows you to have sloped blocks in walls but not have any light bleeding through. In other words, i haven't taken the easy way out and just made sloped blocks act like windows.

There will be collision with sloped objects. I am using a sub-voxel model here so that sloped blocks act as if they are made of smaller cubes.

There will be a decent method of building sloped objects, involving 2 selections only when you need both slope and material to change. Basically, if you want to build a pyramid from sandstone, you will only have to select sandstone, go to the slope menu and then start building. A mousewheel move will change between slopes until you leave the slope menu.
I would also like an auto-build feature for slopes where the game selects the one it reckons you want, but i know this may not always be what the player actually wants.

Oh, and i've written a tool that allows me to import models and calculate which faces to draw in each situation.
I had previoulsy lashed together a tool that worked with hardcoded vertices for slopes (its output is what the current engine uses), but it was limited in what it can do.
EG, the current tree trunk blocks have a top and bottom face consisting of something like 18 triangles each.
These faces are drawn regardless if they are obscured or not. My new tool means the engine knows not to draw these faces if they are obscured.
For a five block tall tree trunk sitting on the ground this means i only now need to draw 18 triangles (for the top face of the top block), where i was drawing 180 triangles previously.
For a forest of 100 trees, this makes a hell of a difference.

I've uploaded an image of my testbed showing the slope lighting in action.

The window at the far wall is letting light through as you would expect, but the left hand wall (which has sloped blocks all the way along) is not letting light in, again, as you would expect.

Posts : 264
Join date : 2011-03-17
Age : 54

Back to top Go down

Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum