Log In  
Log In  

Cart [#58426#] | Code | 2018-10-25 | No License | Embed

Trying out an idea.

Cart [#58425#] | Code | 2018-10-25 | No License | Embed

Well, I stand corrected. If you only process the necessary parts of the screen and fake the rest, you can get the effect to take up much less CPU.

Cart [#58422#] | Code | 2018-10-25 | No License | Embed

I was reading the Dank Tombs articles by Krajzeg and decided to see how far I could get with what I know. I cheated and used a smaller screenspace at 30fps, but not even that could save me from CPU overload...I want to get this effect running well enough that a game could be played using it, but I think at some point to go any farther I'll need to delve into more complicated things than what I'm doing.

P#58424 2018-10-25 17:22 ( Edited 2018-10-26 07:24)

:: dw817

Beautiful !

P#58428 2018-10-25 20:38 ( Edited 2018-10-26 00:38)

Hum...looks like you did not get the core ideas of Krajzeg:
(you get the shading right ;) )

  • don’t work on pixel (use peek/poke to work on pairs)
  • precompute shading pairs (for 16x16 color combinations)
  • compute shading area per row (eg don’t do dist(...) for each pixel ), eg find x where xx+yy=radius for a given y (can even be precomputed).
    Alternative: look at circle rasterization to find boundaries.

Known caveat: your version is pixel perfect, the fast version is not (unless you get the extra mile and got per pixel for the outer boundary)

Edit: realized my code is a bit too complex for demo/tuto purposes. Simplified version below (requires mouse):

Cart [#58458#] | Code | 2018-10-26 | No License | Embed

You can have a look at Nuklear Klone level 2 - I used that very technique @60 fps:
(I have 3 precomputed lights with different radius to simulate flicker and avoid costly sqrt(...) )

P#58436 2018-10-26 03:24 ( Edited 2018-10-26 20:16)

[Please log in to post a comment]

About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2019-03-25 09:29 | 0.023s | 4194k | Q:51