GMLscripts.com

Discuss and collaborate on GML scripts
Invert

You are not logged in.

#41 2009-09-07 05:51:45

xot
Administrator
Registered: 2007-08-18
Posts: 1,239

Re: Yet Another Idiotic Light and Shadow Engine

also, I was wondering about how you cast your shadows up the walls.
I thought you said, you find the point at which the shadow on the floor comes in contact with the wall, and then draw it up.  how exactly are you doing this?

It's very simple. My light map and my model are exactly the same scale and both have their origins in the upper-left corner. The UV coordinates for any vertex in the model is (x/width),(y/height). This is a basic z-axis texture map. All that is required is that the model be rendered to the texture at the correct place and scale, which it does automatically. It should be possible to use differing sizes if one correctly scales the model during the shadow building process. I've not tried this yet. Low resolution light maps would allow for much larger environments but I'm afraid that the light maps might not be of high enough quality, especially for finely detailed shadow casting geometry.

I made some "sun based" shadows that only cast on the floor.  so I'm looking for a way to get them to climb the walls...if you have any ideas AT ALL, please, speak!  I'm up for anything.

This is a level of complexity far beyond what I'm ready to talk about. I don't have any solid ideas for you, at least for real-time use.

If these are to be prerendered light maps I'd ray-trace the shadows and lighting. Iterate across each triangle and build a UV map by shooting rays from the texture pixel to the light, checking for occlusion. It would be extremely slow but you only need to do it once and the lighting should look perfect. It also readily supports all forms of lights and any number of them. This is basically how most FPSes do their static lighting and shadows, or at least that used to be the case. I don't know a whole lot about engines and compilation tools developed since Half-Life's GoldSrc engine.


Abusing forum power since 1986.

Offline

#42 2009-09-10 03:59:02

xot
Administrator
Registered: 2007-08-18
Posts: 1,239

Re: Yet Another Idiotic Light and Shadow Engine

Since I'm in such a good mood, lookie what I have here for you guys.

Here is a proof-of-concept prototype of the lighting system under discussion. Sorry it's taken so long to release. This is most definitely not an engine. It's as if three years of ad hoc development lead to a Frankencode monster that is as obtuse as it is unwieldy. No effort has been made to build proper systems, comment code, or even make it rational. Some stuff will not make sense. All I can say is, it did at one point. Other stuff never made sense.

This is the current generation, about eight iterations out of date (June 24, 2009). It is the first public release and is eight iterations more recent than the only private release (April 20, 2009). Only two people have seen that one. This version is much nicer.

This is almost identical to the version used to make the top-down video seen earlier in this thread. There are only a few small differences. The most significant is that this version has the older/faster/uglier shadow casting code for the dynamic geometry. This version has only mouse control and does not have recording ability.

There may be unused code still in there.
There are probably bugs.
You'll get over it.

Right-mouse-button to move
Shift key to change room speed
F1 for further Help.

http://www.host-a.net/u/xot/wm_ms_em_16-public.gmk


Abusing forum power since 1986.

Offline

#43 2009-09-10 18:11:30

icuurd12b42
Member
Registered: 2008-12-11
Posts: 303

Re: Yet Another Idiotic Light and Shadow Engine

Bute

Offline

#44 2009-09-11 14:03:57

xot
Administrator
Registered: 2007-08-18
Posts: 1,239

Re: Yet Another Idiotic Light and Shadow Engine

Awwww, come on now. You owe me more than a made up word. laugh

Glitches? Frame rates? Hardware? You know the drill.


Abusing forum power since 1986.

Offline

#45 2009-09-11 16:49:31

icuurd12b42
Member
Registered: 2008-12-11
Posts: 303

Re: Yet Another Idiotic Light and Shadow Engine

Bute->Beautyful

Frame rate is decent 172 FPS default setup 50 when all dynamic lights

Alienware m17 laptop, Single ATI Mobility Radeon™ HD 3870

So, Ill go in power saver mode to emulate a regular decent card...

72 FPS in standard setup, 32 FPS with all lights dynamic

Offline

#46 2009-09-11 16:54:59

Joseph
Member
Registered: 2009-09-04
Posts: 14

Re: Yet Another Idiotic Light and Shadow Engine

alright, I don't know much about specs, but...
dell inspiron laptop
vista premium (without using the horrible vista settings)
some crappy GeForce card
1.72 ghz processor
1 gb ram

I ran about a 20/60 fps on your original room.  my highest, disabling and what not, reached about 35-38 fps.
I changed the room to 640x640 and used 2 static lights and the player's dynamic.  1 spider, a box around the room with two inside rooms and 5 pillars.
I managed about 40 fps without disabling anything.  60 after removing blur. 58-60 with blur set to 1. and 70/90 with blur set to 1. and a whopping 110/120 without any blur.

It's slow on my computer, but it's a horribly slow computer anyway.

the engine is so cool though!  too bad spiders didn't cast on the walls sad
other than that, I had no bugs.  no problems changing the room, except I used a wall, and not a wall block, to fill in gaps.
awesome job!

Offline

#47 2009-09-11 17:35:39

xot
Administrator
Registered: 2007-08-18
Posts: 1,239

Re: Yet Another Idiotic Light and Shadow Engine

Hmmm. Interesting. I have to say some of those frame rates are bit disappointing. I get about 120fps on the default settings. I've got a 2GHz Opteron and GeForce 6800 GS which is a mid-range card from about four years ago. Another tester reported numbers closer to 180fps.

So, Ill go in power saver mode to emulate a regular decent card...

72 FPS in standard setup, 32 FPS with all lights dynamic

Those numbers are very discouraging. I'm not sure I'd call that decent, at least I hope it's not. Severely crippled is more like it. I wonder what that mode actually does. Does it simply reduce clock speed? Can you do another test without blur? And a test with the walls "killed" (press K).

The blur is quite expensive, especially when set to a high value. The current version uses a more efficient blur routine.

Joseph, could you run dxdiag (comes with DirectX) and report some more details about your graphics hardware. I'm not sure how to start it on Vista. If you can get to the console/CLI or select "Run..." from the Start Menu (in XP/2000/NT, anyway), type in "dxdiag" without the quotes and press enter.

I plan on working on an update that performs some benchmarking and automatic hardware reporting. I wanted to do that initially but I didn't bother because I was eager to upload what I had.

Thanks for the reports.


Abusing forum power since 1986.

Offline

#48 2009-09-12 00:49:06

Joseph
Member
Registered: 2009-09-04
Posts: 14

Re: Yet Another Idiotic Light and Shadow Engine

video card: Nvidia GeForce Go 7300 (32bit 60Hz)

Offline

#49 2009-09-12 01:35:31

icuurd12b42
Member
Registered: 2008-12-11
Posts: 303

Re: Yet Another Idiotic Light and Shadow Engine

OK... In regular mode, withouth moving the character from its original position

initital speed (no blur)
160-175, waiting for light to come and go
With blur 105-110
no blur, kill wall
180 (whoa, what does kill wall do anyway)
+ all dynamic
110


in power saver mode (which I use to make sure my stuff will be playable on mid-lower end computers... BTW my power saver mode is faster than my other laptop High perf mode nvidia 7600 go)

initital speed (no blur)
109-120, waiting for light to come and go
With blur 92-100
no blur, kill wall
180
+ all dynamic
73


I mean it's not that bad!! Worst case 73, I have 30 FPS to play with while most wanted effects are already in the game...

And your kill wall. those wall just put a cap on the top? Im sure you can figure out a better way to do that. Though the collision uses them too. Also, the step event... Why? static objects should not have any events (triggered each step). I would make a gm model for the all tops. Disabling the draw event boost to 170...

Last edited by icuurd12b422 (2009-09-12 02:20:11)

Offline

#50 2009-09-12 06:01:31

xot
Administrator
Registered: 2007-08-18
Posts: 1,239

Re: Yet Another Idiotic Light and Shadow Engine

You're right, the FPS is not bad. If you are willing to settle for 30 fps there's a lot of head room already. I'm really wanting to get a game running at a solid 60 fps on mid-range machines. That's the only reason I've been a little discouraged by the numbers. I know I can do much better with some optimization and render quality settings for lower end computers.

As for the walls, no optimization has gone into them. They are used to merge themselves together, build the model, draw the caps, and for collisions. Every event could be eliminated with small changes. The caps can be built into the main model or a separate one and they'll look better and render faster. I'm holding off on optimization to keep my options open while this is being developed. I put the Kill command in there because I expect to eventually get rid of the walls instances and handle collisions with SAT. I'm not quite ready to take that step, but I think you can expect to see some nice improvements in the next release.


Abusing forum power since 1986.

Offline

#51 2009-09-12 06:43:57

xot
Administrator
Registered: 2007-08-18
Posts: 1,239

Re: Yet Another Idiotic Light and Shadow Engine

Joseph wrote:

video card: Nvidia GeForce Go 7300 (32bit 60Hz)

OK, thank you, that explains some things. Even though my card is pretty old and of a previous generation, it has more than double the fill rate of yours. That's a vital statistic for this system. Game Maker's API is stuck in the dark ages and I have to do things using multiple full-screen passes. A modern graphics API could do a lot more with a lot less. I hope this fill rate problem isn't a common issue with laptops.


Abusing forum power since 1986.

Offline

#52 2009-09-13 17:33:32

flexaplex
Member
Registered: 2008-12-11
Posts: 72

Re: Yet Another Idiotic Light and Shadow Engine

I'm getting about the same speeds as Joseph, just a tad slower (but then my laptop specs are just a tad worse).
Video Card: Mobile Intel(R) 965 Express Chipset Family (32bit, 60Hz)

Can't wait till I actually settle somewhere and get a good desktop computer.

Still this looks really great and the shadows works well. I don't expect a light engine to work fast on my laptop but I think some further optimisation would still probably be a good idea.

Offline

#53 2009-09-13 17:45:53

xot
Administrator
Registered: 2007-08-18
Posts: 1,239

Re: Yet Another Idiotic Light and Shadow Engine

flexaplex wrote:

I'm getting about the same speeds as Joseph, just a tad slower (but then my laptop specs are just a tad worse).
Video Card: Mobile Intel(R) 965 Express Chipset Family (32bit, 60Hz)

OK, that more or less fits with the other observations:

That chipset has 1.6 Gpixel/s fill rate.

Joseph's has 1.4 Gpixel/s fill rate.

Mine has a 3.4 Gpixel/s fill rate.

icuurd12b42 has a whopping 12.4 Gpixel/s fill rate. Seems like frame rates should be even higher than they already are.

Fill rate certainly isn't the only factor affecting frame rate, but I think it's probably the biggest here. I'm not certain that all of these values are 100% correct.

flexaplex wrote:

Still this looks really great and the shadows works well. I don't expect a light engine to work fast on my laptop but I think some further optimisation would still probably be a good idea.

Would you mind running it again and pressing "K" to kill the wall instances? Let me know if that improves things.


Abusing forum power since 1986.

Offline

#54 2009-09-14 12:36:04

flexaplex
Member
Registered: 2008-12-11
Posts: 72

Re: Yet Another Idiotic Light and Shadow Engine

The kill wall doesn't actually seem to make that much difference, increases the speed slightly that's all.

Offline

#55 2009-09-14 14:42:36

xot
Administrator
Registered: 2007-08-18
Posts: 1,239

Re: Yet Another Idiotic Light and Shadow Engine

Thanks for the info.


Abusing forum power since 1986.

Offline

#56 2009-11-22 22:01:27

icuurd12b42
Member
Registered: 2008-12-11
Posts: 303

Re: Yet Another Idiotic Light and Shadow Engine

The 3d z Buffer fix!!!

Now you can use texture from a surface in 3d because it fixes the surface_set_target...


http://gmc.yoyogames.com/index.php?showtopic=454468&hl=


I thought it would be useful to know for this shadow engine... Now you can draw your shadows on a surface a grab the texture and map it to the model.

Last edited by icuurd12b42 (2009-11-23 03:29:18)

Offline

#57 2009-11-23 03:27:33

xot
Administrator
Registered: 2007-08-18
Posts: 1,239

Re: Yet Another Idiotic Light and Shadow Engine

Argh! Figures the GMC would be down when I clicked that link. I can't wait to read it, I think it might be big help, but I haven't played with this engine in so long I don't remember why it will help exactly. biggrin


Abusing forum power since 1986.

Offline

#58 2009-11-23 06:05:05

xot
Administrator
Registered: 2007-08-18
Posts: 1,239

Re: Yet Another Idiotic Light and Shadow Engine

HOLY SHIT! He figured it out! He figured it out! He figured it out!

I haven't tried it, I haven't even read it, but I can see the screenshot, and I my head is spinning. If this works ... wow! I've got a lot ideas I've been wanting to try.

*tries it*

*salivates uncontrollably*

I had feeling this could be gotten around with a DLL trick.

Mark needs to look at this and implement it natively.

PLUS: It has a depth_clear() function to clear the depth buffer independent of the render target. There are bound to be some tricks that can take advantage of that.

Thanks for the heads-up, icuurd12b42!


Abusing forum power since 1986.

Offline

#59 2009-11-23 06:42:21

icuurd12b42
Member
Registered: 2008-12-11
Posts: 303

Re: Yet Another Idiotic Light and Shadow Engine

I told him to tell mark... But you should report it in the gm8 bug report. Being a mod on the gmc, you may convince him to apply the fix in gm8...

Offline

#60 2009-11-28 02:01:14

IamCalle
Member
Registered: 2007-10-20
Posts: 23

Re: Yet Another Idiotic Light and Shadow Engine

Oh gosh Oh gosh Oh gosh.!
Yaay, awesome news, definitely good stuff!

Mark should definitely implement it.

Offline

Board footer

Powered by FluxBB