I was working on another project today and I made some notes on some things. Most of the bugs you've probably already seen.
3/20/2007
MeshSphere or a new type of sphere primitive could be generated in spherical coordinates instead of cylindrical coordinates to make the ends less pointed.
When rendered with a flat shaded material, one end of a sphere is shaded completely flat (I think it's the +Z end.) With a smooth or wireframe material it looks fine. I think flat shading is averaging adjacent polygon normals.
When you change the Model.Scale numbers it changes the lighting. For example if something is scaled down to 0.2 0.2 0.2 the lighting gets very bright and the front polygons are white. This is an interesting effect but it seems unintended. It looks like the length of the normal vectors aren't adjusted properly (renormalized to equal 1). For now I've been scaling my models in the Mesh.Producer primitives.
A model that uses RenderNet isn't lit properly-- the entire net is one flat color. It looks like the normal vector for each polygon isn't recalculated each frame.
I was trying to make a bitmap by layering two different color BitmapRect but the bitmap wouldn't display the two colors in the editor.
I'm trying to set a CurrentModel.Category within Model.OnSpawn in a ZExpression. The category will be 1 for a positive ball and 2 for a negative ball. I'm getting an error that says "Only float type properties can be used;"
a few bugs and things
Moderator: Moderators
Thanks for reporting these bugs, I have copied your post into my todo-list and will try to solve the problems in later releases.
. This will now be in the 1.02 release.
This must be fixed in a later version, but requires substantial amount of work so I cannot predict when it appear. A preliminary fix would be to introduce a TypeConverter-component with properties "ConvertFrom" and "ConvertTo". Maybe that's a good idea.
Right now the only way to do what you want is to have two different models.
Yes this would be a good idea. You do not happen to know a good algorithm for triangulating a sphere?MeshSphere or a new type of sphere primitive could be generated in spherical coordinates instead of cylindrical coordinates to make the ends less pointed.
I've seen this, yet I do not understand why it happen. I have a debug view which draws the normals as red lines, and the normals look like they are correct and identical on both sides of the sphere. Any idea?When rendered with a flat shaded material, one end of a sphere is shaded completely flat (I think it's the +Z end.) With a smooth or wireframe material it looks fine. I think flat shading is averaging adjacent polygon normals.
I forgot to call glEnable(GL_NORMALIZE) at initializationWhen you change the Model.Scale numbers it changes the lighting.

I could not reproduce this. Does it happen every time, or just once?I was trying to make a bitmap by layering two different color BitmapRect but the bitmap wouldn't display the two colors in the editor.
This is a problem. The scripting system only understands one datatype, the floating point number. Category is an integer so it cannot be used in expressions because there are no type conversions in the language.I'm trying to set a CurrentModel.Category within Model.OnSpawn in a ZExpression.
This must be fixed in a later version, but requires substantial amount of work so I cannot predict when it appear. A preliminary fix would be to introduce a TypeConverter-component with properties "ConvertFrom" and "ConvertTo". Maybe that's a good idea.
Right now the only way to do what you want is to have two different models.
Hmm, I think it would be almost the same as the algorithm that you use now except it would have even steps of phi from 0 to 180°, in spherical coordinates instead of steps on the Z axis.VilleK wrote:Yes this would be a good idea. You do not happen to know a good algorithm for triangulating a sphere?MeshSphere or a new type of sphere primitive could be generated in spherical coordinates instead of cylindrical coordinates to make the ends less pointed.
I think flat shading is averaging some normals from adjacent polygons. If you look at a flat shaded cube the shading is really strange. It's really obvious when you're looking down onto one of the corners of a cube.I've seen this, yet I do not understand why it happen. I have a debug view which draws the normals as red lines, and the normals look like they are correct and identical on both sides of the sphere. Any idea?When rendered with a flat shaded material, one end of a sphere is shaded completely flat (I think it's the +Z end.) With a smooth or wireframe material it looks fine. I think flat shading is averaging adjacent polygon normals.
I'll attach a file here. The Bitmap is under Content - Particles - Bitmap. Run the ZEditor, run the preview, then look at the Bitmap. It seems like running a preview messes up the appearance of a Bitmap.I could not reproduce this. Does it happen every time, or just once?I was trying to make a bitmap by layering two different color BitmapRect but the bitmap wouldn't display the two colors in the editor.
Ok, from the error it seemed like it was a problem with using an integer (Model.Category) in a ZExpression. I was able to work around this I think.This is a problem. The scripting system only understands one datatype, the floating point number. Category is an integer so it cannot be used in expressions because there are no type conversions in the language.I'm trying to set a CurrentModel.Category within Model.OnSpawn in a ZExpression.
Oops, one more thing I noticed. I wasn't able to get -, +, or = to work for a KeyPress.
- Attachments
-
- NMChargedObjects.zgeproj
- (18.26 KiB) Downloaded 722 times
Also, I just found the problem with flat shaded spheres. It turns out that for flat shading open gl use just one normal for each triangle. It does not make an average of the three normals. And for the Z-side of the sphere, it picked the same normal for all triangles: the middle "south pole" vertex! So they were all shaded in the same color. This is now fixed.
I'm currently having a problem with the RemoveAllModels command. For some reason I can't get it to delete my EmitterBall model. In the preview window I have to press C a few times to get it to disappear. In an exe I have to press it 20+ times or so.
If I use SpawnStyle Clone for the EmitterBall, RemoveAllModels seems to work find, but Reference doesn't. I'd like to try to get Clone to work but that causes some other problems.
One other note about the documentation:
In the documentation for ZExpressions the if-statement section doesn't mention != but I used them ok.
I saw you posted version 1.0.2 already! All the fixes look great.
If I use SpawnStyle Clone for the EmitterBall, RemoveAllModels seems to work find, but Reference doesn't. I'd like to try to get Clone to work but that causes some other problems.
One other note about the documentation:
In the documentation for ZExpressions the if-statement section doesn't mention != but I used them ok.
I saw you posted version 1.0.2 already! All the fixes look great.
- Attachments
-
- NMChargedObjects3.zgeproj
- (18.12 KiB) Downloaded 744 times
You have found another bug 
SpawnModel behave incorrect for Reference, it should guarantee only one instance but now there may be several instances. I will fix this in next version.
Workaround: Your MoveEmitter have a zero repeat delay. This makes the spawnmodel execute several times for a single mouse click, triggering the problem of several instances of the same model. Change it to 0.5 and it will work better.
And I've added "==" and "!=" to to scripting page, I don't know why I missed them in the first place.

SpawnModel behave incorrect for Reference, it should guarantee only one instance but now there may be several instances. I will fix this in next version.
Workaround: Your MoveEmitter have a zero repeat delay. This makes the spawnmodel execute several times for a single mouse click, triggering the problem of several instances of the same model. Change it to 0.5 and it will work better.
And I've added "==" and "!=" to to scripting page, I don't know why I missed them in the first place.