Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - dcfingerprint

#1
Hi,

I'm interested in dynamically adding an Object3D to the world and positioning/orienting it relative to a particular Bones Joint in an Animated3D.   

For example - to place an dynamically created object in the hand of a model, and keeping it aligned with the hand as it moves/rotates.  (Or a hat on the head of a model, which will stay on the head, regardless of how the model animates.) 

Any tips for getting the position and rotation to use with either Object3D.setTranslationMatrix(), setRotationMatrix(), or using Object3D.translate(x,y,z) / rotateX(), rotateY(), rotateZ() / rotateAxis() ? 

The Object3D to "attach" could either be a sibling of the Animated3D root, or a child.

Any code samples would be appreciated.  Thanks!
#2
Still getting an exception, but in a different location:

java.lang.ArrayIndexOutOfBoundsException: length=44; index=1330
   at com.threed.jpct.Mesh.calcNormalsFast(Mesh.java:939)
   at com.threed.jpct.Mesh.calcNormals(Mesh.java:545)
   at com.threed.jpct.Object3D.calcNormals(Object3D.java:3382)
   at raft.jpct.bones.Animated3D.attachVertexController(Animated3D.java:452)
   at raft.jpct.bones.Animated3D.<init>(Animated3D.java:117)
   at raft.jpct.bones.AnimatedGroup.clone(AnimatedGroup.java:440)
#3
Thanks!  A combination of reducing the bias and using setCullingMode(false) addressed the issue for this case.   Much appreciated.
#4
More examples attached.  See area around foot nearest floor.
#5
Support / ShadowHelper - shadows cast close to receiver
October 27, 2016, 09:53:33 PM
Hi there,

Been trying out ShadowHelper in the new JPCT-AE along with some animated characters. 
Generally works great!  However, I have noticed some artifacts where shadows do not appear to render properly on the receiver when the casting object (in this case a bones character) is very close. 

In particular, you can see in the images below, the feet of the characters result in a "hole" in the shadow when the feet are near or on the floor.   I've tried experimenting with raising the object further up off the floor - and then it looks OK at some point (no "holes"), however then the scene of course doesn't look right since the character appears floating above the floor, instead of standing on it. 

All objects/meshes from the character are added as casters, and the floor is the single receiver.


                ShadowHelper.setShadowMode(GLSLShadowInjector.PCF_FILTERED_SHADOWS);

                Projector projector = new Projector();
                sh = new ShadowHelper(mRenderer.mFrameBuffer, projector, 1024);

                projector.setClippingPlanes(1f, 1000f);
                projector.setFOVLimits(0, 999);
                float fov = projector.convertDEGAngleIntoFOV((float) fieldOfView);
                projector.setFOV(fov);
                projector.setYFOV(fov);

                projector.setPosition(sv);
                projector.lookAt(caster.getTransformedCenter());

                sh.setLightSource(projector);

                int intColor = Utils.parseColor(shadowColor);
                int red = Color.red(intColor);
                int green = Color.green(intColor);
                int blue = Color.blue(intColor);
                sh.setAmbientLight(new RGBColor(red, green, blue));
                sh.addCaster(caster);

                AnimatedGroup group = getGroup(casterName);
                if (group != null) {
                    for (Animated3D a : group) {
                        sh.addCaster(a);
                    }
                }

                sh.addReceiver(receiver);

Any ideas for config or anything else I may be doing wrong?  Example image attached.

Thanks!
#6
Would it be possible to test by trying with this bones file?  It loads and works fine, animates properly, etc.  Cloning while re-using mesh works fine (as long as this is done prior to any animation).  It is only when attempting to clone (using animatedGroup.clone(false) (not reusing mesh), that the JPCT-AE exception occurs.  Exception at same location also occurs with another completely different model.

I am interested in cloning with reuseMesh false so that I can keep one cached in memory (not attached to a World) and then quickly add multiple copies to a world and have them be able to animate independently.   If I clone with reusing mesh then subsequent clones are disfigured after animating (probably expected) - however please let me know if there's another way to do this (resetting animation prior to clone doesn't seem to help). 

https://www.dropbox.com/s/qzzdyhiiencye26/granny-bones.zip?dl=0

Thanks!
#7
FATAL EXCEPTION in thread: GLThread 248
java.lang.ArrayIndexOutOfBoundsException: length=1640; index=1640
   at com.threed.jpct.Mesh.compress(Mesh.java:286)
   at com.threed.jpct.Mesh.cloneMesh(Mesh.java:382)
   at com.threed.jpct.Object3D.copy(Object3D.java:759)
   at com.threed.jpct.Object3D.<init>(Object3D.java:747)
   at raft.jpct.bones.Animated3D.<init>(Animated3D.java:107)
   at raft.jpct.bones.AnimatedGroup.clone(AnimatedGroup.java:440)

I've seen this exception for a couple of models now when attempting to clone an AnimatedGroup loaded via Bones with reuseMesh = false.  (The model was converted from Blender to Ogre to .bones using jmeOgre2Bones.sh.)    Not a problem in general but has occurred with specific models from completely different sources.  Any ideas?  I can send the .bones file if needed.  Thanks!