Shop OBEX P1 Docs P2 Docs Learn Events
3D graphics with small3dlib and FlexC — Parallax Forums

3D graphics with small3dlib and FlexC

RaymanRayman Posts: 13,859
edited 2020-09-23 20:30 in Propeller 2
I've been testing out various C codes with FlexC...

I was able to get small3dlib working in just minutes: https://gitlab.com/drummyfish/small3dlib

Unfortunately, P2 doesn't have the memory to do all the models and the rendering speed is also slow...
Still, maybe in combo with more cogs and HyperRam for frame buffering, might be able to do something.

Also, there are other codes like this one out there, so maybe there's something better...

Anyway, check out this 160x120 rendering of a textured house on top of 640x150 bitmap of birds:


An amazing 2 fps :(

drummyfish also points out that he has a raycaster that can be used in conjunction with this. That might be interesting...

Comments

  • RaymanRayman Posts: 13,859
    edited 2020-09-23 20:18
    Here's the code. Main program here is ModelViewer.c
    Set for Vga expansion on P0 of Eval Board.
  • RaymanRayman Posts: 13,859
    Oops. Just noticed colors are off. Fixed in the spin2 driver. Image below is all better now.

    4032 x 3024 - 5M
  • RaymanRayman Posts: 13,859
    edited 2020-09-23 21:11
    The text to terminal rendering is interesting... Could be like the Matrix... Doesn't quite work properly with the loadp2 terminal window though for some reason... Doesn't clear screen and home cursor properly, I think...
  • cgraceycgracey Posts: 14,133
    That''s pretty neat, Ray. I bet there's some way to make it go 10 times faster.
  • Could divvy up the image. One cog per region. Run same code, different portion of view port canvas.

  • cgracey wrote: »
    That''s pretty neat, Ray. I bet there's some way to make it go 10 times faster.

    Wot!? Are you planning a 3GHz P3 there Chip? :)

  • cgraceycgracey Posts: 14,133
    potatohead wrote: »
    Could divvy up the image. One cog per region. Run same code, different portion of view port canvas.

    Those circular transforms could be pipelined in the CORDIC. Just one cog could make it several times faster.
  • RaymanRayman Posts: 13,859
    I did another test with just a textured cube... Gets between 11 and 17 fps.

    Figured out how to export the cube from SolidWorks to SW Visualize and then export as .obj and then use the tool to create the .h file for the object.
    Haven't figured out how to do the texture yet... I just used a texture from a different object...

    So, there may be some hope for this...
  • What clock speed were you running the board?

    J
  • RaymanRayman Posts: 13,859
    Looks like it was 300 MHz
Sign In or Register to comment.