Page 1 of 1

Pi3D: Sphere Texture Bug?

Posted: Wed Aug 12, 2015 1:02 pm
by Darkhack
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!

Re: Pi3D: Sphere Texture Bug?

Posted: Wed Aug 12, 2015 9:07 pm
by mahjongg
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.

Re: Pi3D: Sphere Texture Bug?

Posted: Wed Aug 12, 2015 10:19 pm
by paddyg
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))

Re: Pi3D: Sphere Texture Bug?

Posted: Wed Aug 12, 2015 11:16 pm
by paddyg
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.

Re: Pi3D: Sphere Texture Bug?

Posted: Fri Aug 14, 2015 6:22 am
by Darkhack
Wow that looks much better!
I will try this tomorrow.
Thank you very much!

Re: Pi3D: Sphere Texture Bug?

Posted: Fri Aug 14, 2015 2:11 pm
by paddyg
@Darkhack, I've moved pi3d to v2.7 with this fix in so you should be able to pip --upgrade