Log In  


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

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.

update:

  • increased rendering performance (radix sort + pipeline changes)
  • fixed per-vertex shading
31


1

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.


That is so cool!


@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.


1

I love bunny


witchraft


Wabbitcraft !



[Please log in to post a comment]