Archived

This topic is now archived and is closed to further replies.

X-WING-

D3D Iso Engine - LightMap Issues

Recommended Posts

Dear guys, I am switching from ddraw to d3d, and started to convert my isometric engine to support Direct3D, i have did it well, but now i am with some probs, and have some questions. Lets see if any1 can help me, thanks in advance. I have a backbuffer where all my screen is drawed, since i am not working with full 3d, my triangles dont have the Z coord, and also, i just use d3d to blit the terrain, and some other things, so, my terrain tile looks like this: /\ / \ / \ \ / \ / \/ Offcourse my terrain tiles change it sizes when i have some elevation... Now my first problem, after i draw my entire screen, i would like to get the entire backbuffer and do lightning on it (Can be lightmap or another thing that makes it work) The first thing i need to do, is to make the screen darker or brighter. I have did this, but then this second problem got me. I have some lightmaps that i need to apply to the backbuffer in order to do a nice light effect. But after i dark the screen, the lightmap dont looks nice, so, one of my solutions was: 1 Fill Screen with Black + 2 Add diferent lightmaps to the entire area, torches, and stuff = SCENE TOTAL LIGHTMAPPED A Black Image with the Lightmaps blended together then Scene (Screen) + Scene LightMap = Screen Lightmapped Hope you guys got my problem. Also, Sorry for english errors Best Regards.

Share this post


Link to post
Share on other sites
Lighting is not done on a backbuffer, it is done on a per vertex basis. When you call DrawPrimitive you need to have lighting on to do lighting. I suggest getting a book on Direct3D to learn the fundamentals of how Direct3D works.

Possibility

Share this post


Link to post
Share on other sites
You dont got my point, i know exactly how light works in 3d, the problem here is: my engine isnt 3d, its 2d, but uses d3d.

So, i dont exactly have a lighting system, i dont have Z as i mentioned before, my Z is applied on Y axis, what i want to do is to create a lightmap in a buffer, and then apply to the entire scene. Like diablo2 do.

Imagine this:

A Screen allready Drawed.

Then:

a black retangle with screen size,
1 circular gradient BLENDSRC ONE, BLENDDST ONE, at 0,0
1 circular gradient BLENDSRC ONE, BLENDDST ONE, at 20,20
1 uniform gradient BLENDSRC ONE, BLENDDST ONE, at 150,150

Then i apply this lightmap to the entire screen.

Share this post


Link to post
Share on other sites
If I get this correctly you had an engine which used DDraw and now you have changed it to D3D? Well in that case why are you still using the 2d methods... An by that I mean that you use the DDraws methods with D3D. That''s way too slow, to mix DDraw and D3D is terrible, some 3d card does it well thought. I would change it so that you use TL vertices to present tiles. And for lighting I would use vertex diffuse and regular lightmapping.

And don''t just say "I know perfectly well how it works" because if you did you wouldn''t be asking these questions.

Here is an link to good articles on doing 3d in 2´d tile based engines.
http://www.gamedev.net/reference/articles/article935.asp

Hope this clear things up a little.



Pekka Heikura
pekka@heikura.com
http://bnet.webprovider.com

Share this post


Link to post
Share on other sites
I allready use that to draw my tiles man , i am not blting tiles...

Also allready solved the problem, the light things are working good (Not perfect yet), the main engine is perfect for now.

My old engine was only using ddraw, but was 3d in some parts, calculating normals and doing texture mapping and gouraud shading manually.

Old Engine Shot (Using DDraw):
[IMG]http://www.netherdeep.com.br/shot3.jpg[/IMG]

[IMG]http://www.netherdeep.com.br/shot2.jpg[/IMG]

Currently Engine:
http://www.netherdeep.com.br/nd3d_v1.zip

Keys:
+ and - -> Change tile altitulde
F5 and F6 - Increase/Decrease Light
/ and * -> Change tile type

Best Regards

Share this post


Link to post
Share on other sites
Man, your understanding of Direct3D is totally messed. My first post above still applies.

If your using D3D and using triangles but setting the y (or z) pos of your vertices to 0.0, your still using 3D even though your rendering your tiles on a 2D plane. Also, you apply lighting and lightmaps durning the rendering of each triangle, not after. So please, read up and study D3D ALOT more.

Possibility

Share this post


Link to post
Share on other sites