Log In  

Cart #threed-3 | 2019-09-09 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

This cart demos some work I've been doing on 3d rendering - including both flat shading and per-vertex shading.

up/down/left/right - orient
z - change colour palette
x - change render mode

The per-vertex shading is experimental code using sspr for render scanlines from the spritesheet. There are some issues with this - lighting discontinuities possibly fixed-point related.

I wouldn't be surprised if there are some bugs, and I need to update the transform code and add in viewport culling.

Comments/suggestions welcome.


  • increased rendering performance (radix sort + pipeline changes)
  • fixed per-vertex shading
P#67350 2019-09-07 09:55 ( Edited 2019-09-09 15:47)


Nicely done - I was highly skeptical of the efficiency of the OOP constructs, yet it performs very well.
The sspr shading offers interesting avenues - might use later :)

I compared with my own 3d engine, and the performance difference is mostly in the backface culling part - my code is more efficient at determining if a face is visible or not!

FYI, I am projecting camera + light into the 3d model space - that saves rebasing the normals into cam space + I can use pre-calculated n.p for backface culling.

P#67355 2019-09-07 13:51 ( Edited 2019-09-07 13:57)

That is so cool!

P#67357 2019-09-07 14:23
:: jimmi

@freds72 - thanks for the comments. I can see that you could speed things up a bit using the normal to determine front/back facing tris, are you using this to select only visible vertices to project into screenspace? Looking at your gif, there are some very dark tris on the body/feet - I thought they might be holes (but I can see some shading), maybe there is an issue with some of your calculated normals?

OO is just the way I think - so its easier for me to write code that way. I did at one point try to strip this out, but it didn't make a massive difference. I think the issue as far as there is one is that OO code uses more tokens.

Btw, I have just updated the depth sorting algorithm from quicksort to radix sort. This gives a big speed improvement (10-15%), so it might be something you want to look into. Per-vertex shading is now > 30fps.

P#67397 2019-09-08 14:43 ( Edited 2019-09-08 14:44)
:: dmux

I love bunny

P#67398 2019-09-08 17:15


P#67555 2019-09-11 17:11
:: Dan555

Wabbitcraft !

P#71457 2019-12-28 11:48

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2022-08-14 09:17:42 | 0.019s | Q:27