toxibunny
Posts: 1382
Joined: Thu Aug 18, 2011 9:21 pm

Re: Pi3D ES 2.0

Thu Dec 13, 2012 7:25 pm

This is awesome news! I'm busy with other stuff at the moment, but adding a function to allow your own shader code shouldn't be too difficult, should it? You basically just pass it in as a string..?
note: I may or may not know what I'm talking about...

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

Re: Pi3D ES 2.0

Thu Dec 13, 2012 7:57 pm

toxibunny wrote:This is awesome news! I'm busy with other stuff at the moment, but adding a function to allow your own shader code shouldn't be too difficult, should it? You basically just pass it in as a string..?
It's a bit more complicated than that as you need to bind textures, normal maps and other parameters depending on the requirements of your vertex and fragment shaders. This requires several other calls that pass this information on.
Raspberry Pi == small computer == big dreams

User avatar
paddyg
Posts: 2493
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: Pi3D ES 2.0

Thu Dec 13, 2012 10:18 pm

At the moment I'm just using one passe-partout shader which can be made to do or not do various things. There is almost certainly a performance cost to this as pointers must be set in the shader program to access the information for each object to be drawn. However it does mean that you could do quite a lot of things with different shaders without having to change the pi3d library code.

Tim set it up originally to use shader programs in external files and this is a good way to organise things. Here is a list of info that gets passed to the shader (at the moment, quite likely to change). However I have to say that debugging shaders is hard work; they either work or they don't!

vertex; normal; texcoord; # arrays for each object
cameraviewmatrix; eye; rtn; # view point information
ntiles; shiny; # normal map tiling and reflection map strength
locn; rotn; scle; ofst; # orientation of object
lightpos; # light position
fogdist; fogshade; # fog for this object
blend; # if alpha < 1 blend or make see through
material; # shade if not using UV texture
tex0..n # array of textures. At the moment the shader just uses the first three but you could send more and design the shader to use them.
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

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

Re: Pi3D ES 2.0

Fri Dec 14, 2012 9:10 am

tipam wrote:... the more people play with Pi3D, the better we can improve and make fixes!!

I've been playing with baked texture environments which make the RPi look pretty powerful! ...

Image
ConferenceHall demo available at http://www.skillmanmedia.com/pi3d/ConferenceHall.zip
... unzip and read the readme to install and run
You'll like this one! :mrgreen:

Tim
Raspberry Pi == small computer == big dreams

JamesR
Posts: 78
Joined: Sun Aug 05, 2012 11:21 pm

Re: Pi3D ES 2.0

Fri Dec 14, 2012 12:54 pm

Its great. Looks fantastic.

As for feedback, I can tell you the stairs don't work. :D
Actually, if it boiled down to it there is a slight laginess in the forward movement. Ultimately I'm wondering if there can be more code improvement or you would have to consider slowing the camera movement down or reducing the quality. Or live with it. Its very close to smooth.

JamesR
Posts: 78
Joined: Sun Aug 05, 2012 11:21 pm

Re: Pi3D ES 2.0

Fri Dec 14, 2012 2:19 pm

Actually, it really is amazing stuff when you try to run something like gimp on the pi. The reality is that the minor drawbacks always need consideration where the provision is made for omething hat good.

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

Re: Pi3D ES 2.0

Fri Dec 14, 2012 6:20 pm

JamesR wrote:Actually, it really is amazing stuff when you try to run something like gimp on the pi. The reality is that the minor drawbacks always need consideration where the provision is made for omething hat good.
... glad you like it ... more on the horizon as I've done several of them over the years. I just hope to instil some inspiration and the fact that something so small (and cheap) can create great things!
Raspberry Pi == small computer == big dreams

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

Re: Pi3D ES 2.0

Fri Dec 14, 2012 6:38 pm

JamesR wrote:Its great. Looks fantastic.

As for feedback, I can tell you the stairs don't work. :D
Actually, if it boiled down to it there is a slight laginess in the forward movement. Ultimately I'm wondering if there can be more code improvement or you would have to consider slowing the camera movement down or reducing the quality. Or live with it. Its very close to smooth.
... the stairs will work at some point - I've got a very simple (and fast) collision detection method that will enable you to run around multi-level environments and bump into things etc.. may be in early January??
Raspberry Pi == small computer == big dreams

User avatar
paddyg
Posts: 2493
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: Pi3D ES 2.0

Fri Dec 14, 2012 7:59 pm

What's in the box? I hardly dare ask.

Interestingly this is the first demo that hasn't worked at 64 GPU memory. All kinds of random errors until I increased it.

In ES2.0 it's a bit slower but not too much; it takes six seconds to run the length of the hall compared with five seconds on v0.07 I suppose it might overtake in speed when you can use a much simpler model and beef it up by baking detail to a normal map. Something like that might be possible for the railings, i.e. use a simple rectangle with see-through png coupled with normal map so it doesn't look quite so thin.

Have you tried saving any of these big models to obj?
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

JamesR
Posts: 78
Joined: Sun Aug 05, 2012 11:21 pm

Re: Pi3D ES 2.0

Fri Dec 14, 2012 8:44 pm

I think everyone's earn't a rest from it.
I still get to wonder why my object rotates around a point and the earth doesn'tas such but it's centre. Btw the earth looks pretty good in the middle of the hall.
The collision method sounds interesting. Almost all subversion and sublime ideas making things work smoothly aid in making the actual hard work you guys do worth while.

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

Re: Pi3D ES 2.0

Fri Dec 14, 2012 11:57 pm

paddyg wrote:Have you tried saving any of these big models to obj?
... I did try to save in OBJ but the OBJ loader came up with a load of errors whereas EGG worked first time. I think it's because Max7 spews out textures/materials that aren't used whereas the Panda EGG exporter tidies things up nicely.

Also, the textures could be reduced in size with some loss to detail - there are several which are 1024x1024 and these will eat up your 64MB in no time!! I must admit I am spoiled a bit with the 512MB Pi.
Raspberry Pi == small computer == big dreams

User avatar
paddyg
Posts: 2493
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: Pi3D ES 2.0

Sat Dec 15, 2012 10:48 am

Some relatively small normal map and reflection map files adding detail to mars station
Attachments
MegaStation4.jpg
MegaStation4.jpg (35 KiB) Viewed 3045 times
MegaStation2.jpg
MegaStation2.jpg (29 KiB) Viewed 3045 times
MegaStation1.jpg
MegaStation1.jpg (39.9 KiB) Viewed 3045 times
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4258
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: Pi3D ES 2.0

Sat Dec 15, 2012 10:54 pm

A couple of notes for the manual:
Step 3.

Install the Python Imaging Library by opening a terminal and entering:

su root

apt-get install python-imaging
You also need python-imaging-tk

Also you may need to edit the examples and change the screen size. Perhaps I'm odd, but I'm on a 1280x1024 screen and Earth.py doesn't work and all of the examples are strangely stuck in the bottom right-hand corner. Changing the relevant line in each example to:

Code: Select all

display = pi3d.display(0,0,1280,1024)
works perfectly.

JamesR
Posts: 78
Joined: Sun Aug 05, 2012 11:21 pm

Re: Pi3D ES 2.0

Sat Dec 15, 2012 10:58 pm

Yes, it's useful to know how the change the position of the window. It's probably one of the first things anyone needs to know.

It's less of an issue on hd for me, but tricky. Well good luck with your tinkering.

Gibble
Posts: 56
Joined: Wed May 09, 2012 9:52 am

Re: Pi3D ES 2.0

Wed Dec 19, 2012 4:32 pm

Just wondering, how feasible would it be to use Pi3D ES 2.0 on a Linux desktop to develop (don't have a separate screen for the Pi, so it hinders me a bit). I'm guessing its mainly the 3D initialisation of display and egl types etc or something which are unique to the Pi, or is there a lot more ? (hmm plus I guess it depends if your gfx card supports 2.0 anyway)

Do any of you code on another platform and then test on the Pi (I know you can ssh remote and get it to display to another screen ok)?

toxibunny
Posts: 1382
Joined: Thu Aug 18, 2011 9:21 pm

Re: Pi3D ES 2.0

Wed Dec 19, 2012 4:41 pm

I code via SSH and view it on the pi composite out...
note: I may or may not know what I'm talking about...

User avatar
paddyg
Posts: 2493
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: Pi3D ES 2.0

Wed Dec 19, 2012 6:06 pm

Getting the Pi3d library to work on other machines is on the list but I'm afraid it comes below
- getting ES2.0 working (this is now not too bad but still some efficiency to add see github.com/tipam/pi3d/integration brance)
- making the interface easy to use (beginners and children friendly)
- sorting out the threading and 'game engine' loop
(from memory, see a post by Tom Swirly elsewhere)
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4258
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: Pi3D ES 2.0

Sun Dec 30, 2012 5:03 pm

I use jEdit on my Ubuntu PC. It has a plug-in that allows me to connect to the RaspPi with SSH FTP transparently. Then I need another terminal window open with SSH FTP open so I can upload textures that I build with the Gimp. On the Pi I can just continually execute the application -- up-cursor, Enter.

Metatronin
Posts: 55
Joined: Sat Aug 04, 2012 5:19 am

Re: Pi3D ES 2.0

Sun Dec 30, 2012 9:35 pm

Would you guys use low-poly model packs if'n I made some? What would be the easiest(portable cross platform) to use, .obj so UV mapping is intact?
The polycount on that tank looks insane and the 16fps make alot of sence. Whats the polycount on it if you don't mind?

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4258
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: Pi3D ES 2.0

Tue Jan 01, 2013 12:53 am

My first attempt:

An ancient temple buried in drifting sand.
https://github.com/rurwin/pi3d

Run silo.py
Standard ForestWalk keys work, but you can also use the left mouse button to move forward for a better experience.

Minor changes to pi3dcommon.py to allow that.

Also solid models that you can't walk through. (it is just possible to get out ;-) )

User avatar
paddyg
Posts: 2493
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: Pi3D ES 2.0

Wed Jan 02, 2013 5:33 pm

Richard. Quick scan though silo.py code on github looks to have some excellent ideas. The buildingfromimage class should be in the standard library! I'm going to wire the pi up and try it out.

The ES 2.0 version has made several major speed improvements over the last couple of weeks. Mainly getting rid of any 'if' statements in the shaders but other ways as well. I would say it's faster than the ES 1.0 version in pretty well all circumstances now. I've not implemented the FPS in the tank demo but it takes about half the time to perform a 360 and it takes about 60% of the time to run from one end of the ConferenceHall to the other!

Metranoni. *YES* it would be really good to have loads of low poly models available. Obj files are a lot faster to load than Egg and I haven't written any other parsers yet! In the ES 2.0 version we can have normal maps which allow you to 'bake' hi resolution detail into images. I've done an experiment with this in Blender, nothing yet for real but it seems to work.
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

User avatar
paddyg
Posts: 2493
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: Pi3D ES 2.0

Wed Jan 02, 2013 8:42 pm

Excellent maze. Truly claustrophobic.

You could probably use the same createCuboid for all the merging without having to create new instances each time which would probably make it load faster. I will have a go at converting it to ES 2.0

Also might be scarier with more gloomy lighting inside the silo!

Paddy
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4258
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: Pi3D ES 2.0

Wed Jan 02, 2013 9:58 pm

paddyg wrote:The buildingfromimage class should be in the standard library!
Feel free to grab it. And thanks for the nice words. Can I also put in a request for the changes I made to pi3dcommon -- to allow the mouse buttons to be used separately? It's so much easier moving forward with the left mouse button and stopping when you take your finger off, rather than filling up the keyboard buffer with W-keys.

One thing I can't do with the buildingfromimage methodology is to have different textures for ceilings (or even for different sections of the building.) Maybe that would be possible with ES2.0?

The reason it's called silo is that I intend to create a Cholo-like game but with the aim of teaching programming -- ie the robots can be re-programmed. I've got a long way to go. If someone is interested in creating models, can I put in a request for some models of people? I have zero artistic talent; robots I can do, furniture I can handle, but people are beyond me. Animated people would be wonderful, but even static ones would be good enough.

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4258
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: Pi3D ES 2.0

Thu Jan 03, 2013 1:33 pm

Multiple textures in one building.
silo2.jpg
silo2.jpg (15.31 KiB) Viewed 2824 times
silo1.jpg
silo1.jpg (31.67 KiB) Viewed 2824 times

User avatar
paddyg
Posts: 2493
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: Pi3D ES 2.0

Fri Jan 04, 2013 9:57 am

Hopefully I'll get a chance to look at this today.

This is a screen capture video of the ES 2.0 shader version, it's just of 60FPS on the pi
http://www.youtube.com/watch?v=X6K4aRTY1as
The spheres have been merged into one object, if left separate it drops to 15FPS
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

Return to “Python”