Jump to content
  • Advertisement
Sign in to follow this  
IsItSharp

Simple 3D Pathtracer on a microcontroller

This topic is 581 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

 

because i love the idea of pathtracing i would like to port a simple 3D pathtracer (at first only with spheres) to a microcontroller. Because microcontrollers don't have a lot of RAM (usually) i have to figure out, how much i would actually need. I have a TFT-Display with 128x128 pixels. The last time i wrote a (very simple) pathtracer for a desktop-pc, i used a byte-array with 3 bytes (red, green blue) for every pixel. To do this on a microcontroller this would lead to a total ram consumption of at least ~50kB! Do you have any ideas how i could shrink that memory consumption by saving data more efficiently?

Edited by IsItSharp

Share this post


Link to post
Share on other sites
Advertisement

you could use 5-6-5 rgb color encoding (16bit per pixel instead of 24) - but you also could use tiles (this is what oold hardware did) I do not know what your microcontroller is capable of, so it's hard to tell if it will work or not.

On the other hand if your microcontroller is so limited in resources I doubt that it will have enough computational power to do pathtracing in realtime at sufficient fps rate.

Share this post


Link to post
Share on other sites

a microcontroller is generally only going to have its own internal registers and not really any kind of memory for actual storage if you are really talking about a microcontroller.  unless you mean another actual processor.

Share this post


Link to post
Share on other sites
You could do something similar to what quake 2 did with its software renderer.

In short create a colour mapping of colours in 256 colour mode that emulate rgb, e.g. 2 bits red, 3 bits green and 2 bits blue, saving a spare bit for alpha blending.

Why an extra bit for green you ask? Simple. Human eyes are more sensitive to green light so you'll appear to have a wider colour range by using more bits for the green channel.

Note that this isn't entirely exactly like the way quake 2 did it because their pallette seemed to prefer reds, yellows and browns for some Gameplay specific reasons I forget right now.

The full writeup is here: http://fabiensanglard.net/quake2/quake2_software_renderer.php

Let me know if this helps at all. :)

Share this post


Link to post
Share on other sites

Even with only 8 bit per pixel you'd still need 16K for a 128x128 pixel image. There is no way around adding some RAM somewhere. How are you driving that display? If it is one of those displays you communicate with over SPI, it will already have enough memory built in. Otherwise there are dedicated driver ICs that either have some internal VRAM or can be connected externally to it. 

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!