A bug with sprites and setRenderModePerspective(True)?

Heres the archive with media and source:

heres a video demonstrating the problem:

if you didnt notice, the setRenderModePerspective(True) doesnt work, but after 10 seconds it is apllied instantly.

import direct.directbase.DirectStart
from pandac.PandaModules import *

model = loader.loadModel('suzanne')

model.setRenderMode(RenderModeAttrib.MPoint, 0.04)
model.setTexGen(TextureStage.getDefault(), TexGenAttrib.MPointSprite)

texture = loader.loadTexture('tex.png')
model.setTexture(texture, 1)

For higher res models it can just crash after zillion log messages.
Also, can you tell me how much fps you get?

Im getting 59-60 fps on Geforce 9400gt, Core2Quad 2.6GHz, Win7(32)

You shouldn’t use setRenderMode(MPoint) for complex models, because this can cause the CPU to work overtime to generate the thousands or millions of vertices necessary to render your perspective points. If you really do want to do this, you should at least set:

hardware-point-sprites 1

to force this computation to be done on the GPU instead.

But honestly, it’s hard to imagine why you would want to do this for an arbitrary model.


Why not? Isnt that how particles work? I can have few thousands of them not slowing down my hardware
Currently I use mpoint rendering for animated stars on my skydome.
Praios had an idea to use sprites for his trees instead of billboards, which cant be flattened.
To be honest I wanted to do something like that myself.

I think this game does a similar thing for distant trees

Sure, you can create a Geom with thousands of points; use GeomPoints for this purpose. This is indeed how particles work.

You only run into trouble when you use setRenderMode(MPoint), which converts an ordinary GeomTriangles into a points rendering by creating a point at each vertex. First, that’s a weird thing to do–if you wanted points, why did you create triangles?–and second, it’s difficult to do this on the CPU when you have many, many thousands of triangles in the first place.

Panda only supports MPoint because OpenGL does. But that doesn’t mean it’s a good idea. :wink:


Long story short, ‘I shouldnt use triangles because of how they store data there are dublicate vertices’. Did I get it? So if I delete the faces and keep the vertices in my modeller its ok?
I got another problem that isnt really visible with this texture. Basically, the textures are upside down.

That’s one of the problems with triangles. Why not just model points in your modeler? The egg file support points too.

Textures are indeed upside-down with textured points. That’s the way sprites work. Don’t blame Panda, blame the graphics card manufacturers, who defined this specification. You can’t even use a setTexScale() to fix it reliably. The most reliable way to fix it is to paint your textures upside-down to compensate.


I can do that but only not in 1 case: If I want the object to be textured the normal way. You might wonder why on earth i might want that, but i have found that lerping a white and transparent difference cloud texture’s uv is an easy way to make animated starfied (for a skydome/skybox).
If its consisted of points it cant have uvs i guess.

Why can’t your points have UV’s?

I dont know, they can?
They dont appear in the UV Editor of Blender at all, so they cant be selected. I sure hope it isnt another thing Blender forcefuly disables because the devs didnt think it is of any use.
Ill test it.

Heh, it seems Chicken doesnt export anything with only vertices.
This is what I get:

<CoordinateSystem> { Z-up }

<Comment> { "Egg laid by Chicken for Blender, version R91" }

<Group> Plane {