Darkhack
Posts: 2
Joined: Sat Aug 08, 2015 7:15 am

Pi3D: Sphere Texture Bug?

Wed Aug 12, 2015 1:02 pm

Hello!

This is my first forum post!
I am programming a external Navball for the game Kerbal Space Program. It should run on the raspberry pi with a little hdmi tochschreen display. I decided to use KRPC https://github.com/djungelorm/krpc to acess the game over python and pi3d https://github.com/tipam/pi3d to render the Spaceball. So i took the pi3d demo "orbit.py" and modified it to one spere with this texture:Image
I also took the angle data from the game to rotate the spere. So my program works but there is a big fault. At the top and the bottom of the spere the texture is blurred and distorted. So the angle markers in the texture are not at the proper place. I've tried everything but i can't find the bug. Is this maybe a bug in pi3d?

Picture of the rendered sphere with the blurred top:
Image

Hope anyone can help me.

Thanks!

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13142
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Pi3D: Sphere Texture Bug?

Wed Aug 12, 2015 9:07 pm

I notice there are lines of white pixels at the bottom and top of the source picture, that would account for the white top of the ball, or am I missing something? What do you mean by "distortion"?

P.S. I also took the liberty to enlarge the ball picture, using [size=x] tags.

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

Re: Pi3D: Sphere Texture Bug?

Wed Aug 12, 2015 10:19 pm

Hmm, I think the last bit of texture mapping is stretched as you say. Quite a few of the standard shapes (including Sphere) use the Shape.lathe() method which I will have a look at. (The triangles at the poles also look to have z-fighting (or just wrong normals))
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

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

Re: Pi3D: Sphere Texture Bug?

Wed Aug 12, 2015 11:16 pm

That's better.
[attachment=0]spaceball.jpg[/attachment]
I've pushed the patch up to github on the develop branch
https://github.com/tipam/pi3d/commit/8e ... e83f2c8ac5
There are several other improvements that warrant a proper release which I will do over the next day or two if you can manage till then and/or don't want to use a git version.
Attachments
spaceball.jpg
spaceball.jpg (55.71 KiB) Viewed 2126 times
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

Darkhack
Posts: 2
Joined: Sat Aug 08, 2015 7:15 am

Re: Pi3D: Sphere Texture Bug?

Fri Aug 14, 2015 6:22 am

Wow that looks much better!
I will try this tomorrow.
Thank you very much!

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

Re: Pi3D: Sphere Texture Bug?

Fri Aug 14, 2015 2:11 pm

@Darkhack, I've moved pi3d to v2.7 with this fix in so you should be able to pip --upgrade
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

Return to “Graphics programming”