User avatar
tipam
Posts: 83
Joined: Fri Dec 30, 2011 1:32 pm
Contact: Website

Star Citizen on the Raspberry Pi?!

Tue May 29, 2018 9:37 am

NOTE: - this post has developed somewhat! ... there's now a downloadable demo on page 3 of this forum so check it out!

Hi,

I thought I'd share a couple of video links and a few pics of my Star Citizen style Cargo Ship(!) trying out OpenGLES 2/C++ on the RPi 3 B ...

The model is detailed inside and out using a basic custom shader at around 35-55 fps in X11. Id like to see if i can improve that using non-x11 drivers in Raspbian Stretch ... anyone done this yet?

I hope to generate a mini-simulation/game walking onto the ship, navigating around it to the bridge and then taking off a planet (not too much to ask from an RPi :lol: )

Anyway, here are my pics and links ...

https://www.youtube.com/watch?v=u-quGjXq7Wk&t=10s
https://www.youtube.com/watch?v=Zqp_TtjeIlY

Image
Image
Image
Image
Image
Image
Last edited by tipam on Thu Jul 05, 2018 7:58 pm, edited 1 time in total.

User avatar
tipam
Posts: 83
Joined: Fri Dec 30, 2011 1:32 pm
Contact: Website

Re: Star Citizen on the Raspberry Pi?!

Thu May 31, 2018 8:49 am

Just to note, I will be uploading this code on GitHub quite soon with instructions etc.. Code will include an OBJ loader, window classes (easy to use), shader & image loaders etc.. Anyone interested?

User avatar
hanzelpeter
Posts: 70
Joined: Mon Jul 09, 2012 11:56 am

Re: Star Citizen on the Raspberry Pi?!

Thu May 31, 2018 4:01 pm

Yes. Sure.

I like 3d models on my RPI. Also when there is a nice autorotate.....

User avatar
tipam
Posts: 83
Joined: Fri Dec 30, 2011 1:32 pm
Contact: Website

Re: Star Citizen on the Raspberry Pi?!

Thu May 31, 2018 6:02 pm

@hanzelpeter ... OK, will do.

I'll tidy up and upload. Link to be posted soon.

Auto-rotate will be an easy thing to do. You can try out any OBJ model and 'skybox' if you like.

Perhaps you can post your 'creations' ;)

User avatar
tipam
Posts: 83
Joined: Fri Dec 30, 2011 1:32 pm
Contact: Website

Re: Star Citizen on the Raspberry Pi?!

Mon Jun 04, 2018 9:25 pm

... just added the Cargo deck ...

Image
Image
Image

I'll be adding the living quarters and bridge. The idea being that you can 'seemlessly' walk around the whole ship by employing a 'portals' technique.

User avatar
Gavinmc42
Posts: 2108
Joined: Wed Aug 28, 2013 3:31 am

Re: Star Citizen on the Raspberry Pi?!

Tue Jun 05, 2018 8:21 am

Wow, on Pi3B+?
If it is mostly VC4 code then a similar frame speed on a Zero?
I mostly use Zero's USB booting for VC4 coding, saves SD card messing about.

How much SDL did you need to use?
https://ultibo.org/forum/viewtopic.php? ... =SDL#p5586

This is the sort of stuff I want to learn how to do baremetal.
https://ultibo.org/forum/viewtopic.php? ... S&start=30

OpenVG was simple as there is a good example ported from AJ Sharps code.
OpenGLES is harder without good examples that make sense?

Was this all done on a Pi or did you use PC tools?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
tipam
Posts: 83
Joined: Fri Dec 30, 2011 1:32 pm
Contact: Website

Re: Star Citizen on the Raspberry Pi?!

Tue Jun 05, 2018 6:11 pm

If it is mostly VC4 code then a similar frame speed on a Zero?
I mostly use Zero's USB booting for VC4 coding, saves SD card messing about.
Not sure - I've got a Zero so I'll try it out - be nice if it were!
How much SDL did you need to use?
Code uses SDL2/OpenGL quite extensively.
OpenGLES is harder without good examples that make sense?
I've written the code so it's simple to use including a shapes library that will support extrusions
Was this all done on a Pi or did you use PC tools?
The ship model was made in 3DS Max with some tweaking through Blender.

User avatar
hanzelpeter
Posts: 70
Joined: Mon Jul 09, 2012 11:56 am

Re: Star Citizen on the Raspberry Pi?!

Tue Jun 05, 2018 6:26 pm

My examples are just small OpenGLES tests.

See https://github.com/hanzelpeter/opengles_plays and README.md for pictures.
Nothing so cool like your engine.

User avatar
tipam
Posts: 83
Joined: Fri Dec 30, 2011 1:32 pm
Contact: Website

Re: Star Citizen on the Raspberry Pi?!

Tue Jun 05, 2018 9:24 pm

hanzelpeter wrote:
Tue Jun 05, 2018 6:26 pm
My examples are just small OpenGLES tests.

See https://github.com/hanzelpeter/opengles_plays and README.md for pictures.
Nothing so cool like your engine.
... looks really cool to me!!

User avatar
tipam
Posts: 83
Joined: Fri Dec 30, 2011 1:32 pm
Contact: Website

Re: Star Citizen on the Raspberry Pi?!

Tue Jun 05, 2018 9:47 pm

@gavinmc42
If it is mostly VC4 code then a similar frame speed on a Zero?
... I just tried the ship on my Pi Zero and I'm seriously stunned that it appears to run as fast as my Pi3 model B on a 64MB GPU partition! :shock: :P

I can't run anything else (like Geany) in x11 (not enough memory) and the Zero does need a heatsink :oops:

Here's a snapshot (notice the CPU running at 50-60% usage)

Image

User avatar
Gavinmc42
Posts: 2108
Joined: Wed Aug 28, 2013 3:31 am

Re: Star Citizen on the Raspberry Pi?!

Wed Jun 06, 2018 1:32 am

... I just tried the ship on my Pi Zero and I'm seriously stunned that it appears to run as fast as my Pi3 model B on a 64MB GPU partition! :shock: :P
That's what I was hoping :D
I would have expected 128MB would be needed :o

Time to get rid of that Linux/X11 stuff.
With Ultibo the kernel is about 3MB so that leaves heaps for GPU ;)
But then SDL lib etc needs to be compiled into Ultibo.

I did not need any extra libs for OpenVG when I use it in Ultibo.
I am hoping OpenGLES is similar, all the magic is buried in the start_x.elf.
Actually I think start_x.elf has the extra camera stuff, not sure if it is needed for OpenVG/GLES.

Might have to bite the bullet and learn Blender and 3DS Max, Povray can only get me so far :lol:

Your ship is the best Pi OpenGLES example I have seen, much better than a few rotating cubes or that Python3D stuff ;)
The exhaust is icing the cake and showing off, well done :D
Raises the bar for us mere code hackers ;)
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
tipam
Posts: 83
Joined: Fri Dec 30, 2011 1:32 pm
Contact: Website

Re: Star Citizen on the Raspberry Pi?!

Wed Jun 06, 2018 7:04 am

Raises the bar for us mere code hackers ;)
You're right - I underestimated what the Pi (Zero esp.) can do.

I was also pleasantly surprised how fast the model loaded from a raw OBJ ... only a second or so .. meaning much of the geometry can be kept on the SD card until needed. This could be sped up again if saved in binary format. The textures took longer to load, but I haven't really done much optimisation yet anyway.

Apart from editing and compiling, I'll make my target machine a Zero - I always enjoy a good challenge ;)

I'm not so good on Blender - I happened to have an old copy of 3DS Max 7 that I purchased years ago so I'm used to it :)

User avatar
Gavinmc42
Posts: 2108
Joined: Wed Aug 28, 2013 3:31 am

Re: Star Citizen on the Raspberry Pi?!

Wed Jun 06, 2018 8:51 am

I was also pleasantly surprised how fast the model loaded from a raw OBJ ... only a second or so
I had to look up the obj file format, did not know it was text.
Learned more about 3D in the last day than the last 6 months, those OpenGL books are useless.
It helps when someone points in the right direction and proves it can be done.

Did some research on 3D CAD software that make OBJ ;)
I have been using FreeCAD for years for STL files, turns out it exports obj too :D
Even sort of does texture mapping, that means I don't have to learn new stuff, whew :lol:
It can be tested on FreeCAD before exporting to Pi's.

Yep obj to OpenGLES looks like it might be a good, simple way to do models on Pi's.
For Ultibo a Pascal obj to OpenGLES parser might be the way to go, even I might be able to figure that out :oops:
I will keep it as text format and worry about binary much, much later.
I suppose it could be preconverted from obj to OpenGLES to save some time?

Or into Pascal objects?
Clues in the Castle Game Engine?
That might make more sense now.

Time to take my Povrap Blimp design and try to FreeCAD it to obj.
There is a obj to pov converter, for rendering?
http://www.povray.org/resources/links/3 ... Utilities/

Thanks for showing me what can be done.
I have not touched baremetal gaming on Pi's since Feb as I had no idea how to proceed.
Now I have a clue how a simple game like the original Wolfenstein could be done. :idea:
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
tipam
Posts: 83
Joined: Fri Dec 30, 2011 1:32 pm
Contact: Website

Re: Star Citizen on the Raspberry Pi?!

Wed Jun 06, 2018 11:43 am

@Gavinmc42

... I must admit I haven't looked into Ultibo ... your intro video really shows off its simplicity!

If you can do an Ultibo/Pascal equivalent that would be great! ... it certainly would max out the potential of the Pi.

You mentioned earlier about compiling SDL2 into Ultibo ... how difficult is that? (inc. SDL2_image / SDL2_mixer / SDL2_net / SDL2_ttf ... now that's a big ask!)

User avatar
Gavinmc42
Posts: 2108
Joined: Wed Aug 28, 2013 3:31 am

Re: Star Citizen on the Raspberry Pi?!

Wed Jun 06, 2018 12:44 pm

your intro video really shows off its simplicity!
Not my video, that's Garry's work, the creator of Ultibo.
I'm just a hardware guy who got tired of Linux getting in my way of making gadgets.
Lucky I found Ultibo 2 years ago, now I'm one of it biggest fans.

I get to learn software without Linux getting in the way.
Keeping track of dependencies and massive Raspbian OS backups was causing me software project management issues.

Thankfully there are better coders than me trying to do crazy stuff like SDL ;)
C library interfacing is coming along, if you understand that stuff, personally I don't need it yet.

pik33's windowing and audio is impressive.
https://ultibo.org/forum/viewtopic.php? ... &start=120
Paul and Mark are moving Bluetooth LE along

I do a little bit of Graphics stuff, mostly OpenVG as Garry's port of AJ Stark code made sense to me.
The most fun was doing a port of Hansolo's Medusa JavaFX Industrial Clock.
https://github.com/Gavinmc42/Industrial-clock
I have used his stuff doing JavaFX apps on Raspbian years ago.
Doing it baremetal was much smaller, 3MB verses 5GB, and easier that the Netbeans JavaFX methods.

Hope to one day do Aarch64 NEON CV/ML/AI coding, playing with that in Gentoo64.
viewtopic.php?f=54&t=188448

Only a few non green boxes left on the status page :D
https://ultibo.org/wiki/Current_Status
Ultibo 3.0 is going to be very interesting, but I still have plenty of things I can do with 2.0 :lol:
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Gavinmc42
Posts: 2108
Joined: Wed Aug 28, 2013 3:31 am

Re: Star Citizen on the Raspberry Pi?!

Thu Jun 07, 2018 6:16 am

http://asphyre.net/products/pxl
OpenGL ES rendering with and without X server, including drawing to bitmaps
This might make sense now.
There is Asphyre support in Ultibo
https://github.com/ultibohub?tab=repositories

Seems to be plenty of free 3D obj files around to play with, whew ;)
The trick seems to be obj file to opengles array conversion.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Gavinmc42
Posts: 2108
Joined: Wed Aug 28, 2013 3:31 am

Re: Star Citizen on the Raspberry Pi?!

Thu Jun 07, 2018 6:51 am

I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
tipam
Posts: 83
Joined: Fri Dec 30, 2011 1:32 pm
Contact: Website

Re: Star Citizen on the Raspberry Pi?!

Thu Jun 07, 2018 1:00 pm

The trick seems to be obj file to opengles array conversion.
I'll be uploading my OBJ code soon so you can take a look ... basically the OpenGLES arrays can be setup how you want.
In my case I'm using an array record of ...

Code: Select all

vec3f position
vec3f normal
vec2f uv
(stride of 8 floats)

You can also add a ton of other stuff (such as colour, secondary UVs etc..) but for RPi purposes this array record is sufficient.

I suppose the code I'm uploading is a mini-engine employing hierarchical transforms, scene manager, model and resource management for mesh, material and textures. Other goodies include avatar, camera and light classes plus a general default shader.
3D games on Zero's?
Why not? :P

User avatar
Gavinmc42
Posts: 2108
Joined: Wed Aug 28, 2013 3:31 am

Re: Star Citizen on the Raspberry Pi?!

Fri Jun 08, 2018 1:02 am

I suppose the code I'm uploading is a mini-engine employing hierarchical transforms, scene manager, model and resource management for mesh, material and textures. Other goodies include avatar, camera and light classes plus a general default shader.
Yep, all you need is multiple objects, physics, collision stuff and some AI and you have a full game engine, I think.
I have looked at the Castle Game Engine but it is too big for me to get my tiny brain around at this point of my learning curve :oops:
Whereas your screenshots and Youtube videos made sense to me ;)

With some scripting code you can have a pretty good 3D demo or presentation/display engine.
Pi Display stuff to the next level, displays are a known market for Pi usage.
Exploded diagrams for product marketing, spare parts etc.

The display guys will probably have lots more ideas.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
tipam
Posts: 83
Joined: Fri Dec 30, 2011 1:32 pm
Contact: Website

Re: Star Citizen on the Raspberry Pi?!

Fri Jun 08, 2018 2:51 am

Update ... added a docking base model ..

Image
Image
Image
Image

User avatar
Gavinmc42
Posts: 2108
Joined: Wed Aug 28, 2013 3:31 am

Re: Star Citizen on the Raspberry Pi?!

Fri Jun 08, 2018 3:42 am

Showing off now :lol:
You got the entire collection of Star Citizen ships coming to Pi's?

Been doing some obj file googling, Star Trek and Star Wars models are around :o
Lots of people have being making 3D models of things, whole new world to me.
3D File formats that support vertices, faces, textures and animation, it is all finally making sense.

I now understand how Quake Player skins work, better later than never :lol: .
Even starting to get an idea on how Blender must work, how to use it and why it is popular.

Thanks Tim.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
tipam
Posts: 83
Joined: Fri Dec 30, 2011 1:32 pm
Contact: Website

Re: Star Citizen on the Raspberry Pi?!

Tue Jun 12, 2018 10:48 pm

Update 3: Large scene Rendering

Just uploaded another video demonstrating large scene rendering using multiple VBO's ...

https://youtu.be/Y91jHLkXl4I

Code now comprises of a hierarchical scene manager that seamlessly supports multiple VBO's, materials and textures. I hadn't realised the RPi could only handle 65k vertices per VBO and so I needed to write a manager to handle this.

The OBJ loader now merges meshes of the same material to drastically reduce the number of draw calls. Previously I had to collapse meshes of the same material which took me ages!

Here's a few pics of the 'large' scene comprising around 90k vertices and 40k+ triangles ..

Image
Image

Also, as mentioned in the video, I'll be detailing sections of the cargo ship and docking station so the player can walk around without noticing changes between the scenes. Here's the detailed cargo bay (images also shown earlier) ...

Image

User avatar
Gavinmc42
Posts: 2108
Joined: Wed Aug 28, 2013 3:31 am

Re: Star Citizen on the Raspberry Pi?!

Wed Jun 13, 2018 7:03 am

It took me some time to notice the glxgears demo running in the screenshot.
viewtopic.php?f=54&t=188448

I just got the Mesa3D demo stuff compiling on Gentoo64.
https://www.mesa3d.org/install.html
There is a simple 3D terrain demo that works ;)
Lots of other demos run too ;)

Wondering if your code would run any faster in Aarch64 and if it can be done in OpenGL and not GLES.
For OpenGL I think Eric Anholt has a layer above OpenGLES that converts it?
OpenGL code will compile for 32bit Zero's too?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
tipam
Posts: 83
Joined: Fri Dec 30, 2011 1:32 pm
Contact: Website

Re: Star Citizen on the Raspberry Pi?!

Wed Jun 13, 2018 2:00 pm

Gavinmc42 wrote:
Wed Jun 13, 2018 7:03 am
It took me some time to notice the glxgears demo running in the screenshot.
viewtopic.php?f=54&t=188448

I just got the Mesa3D demo stuff compiling on Gentoo64.
https://www.mesa3d.org/install.html
There is a simple 3D terrain demo that works ;)
Lots of other demos run too ;)

Wondering if your code would run any faster in Aarch64 and if it can be done in OpenGL and not GLES.
For OpenGL I think Eric Anholt has a layer above OpenGLES that converts it?
OpenGL code will compile for 32bit Zero's too?
Would be interesting to find out although all my code is 32bit/single float precision??

User avatar
tipam
Posts: 83
Joined: Fri Dec 30, 2011 1:32 pm
Contact: Website

Re: Star Citizen on the Raspberry Pi?!

Sun Jun 24, 2018 11:36 pm

Just another update ...

I've been working on collision detection that now works .. I have a ball bouncing around inside the ship :D
This can be simplified further to enable a player avatar to walk about - up stairs, jump off platforms etc..

The next stage is to get the portals working so I can seamlessly navigate between 'rooms' and levels.

I'm also factoring the code so anyone can create their own game - sorry for the wait on this one!

Also ported the code to Windows and will have it working on Android as well (not sure about MacOS / iOS esp. since they're dropping all OpenGL support!)

Return to “OpenGLES”

Who is online

Users browsing this forum: No registered users and 0 guests