Recent Posts

Pages: 1 [2] 3 4 ... 10
11
Support / Re: Increase number of texture units
« Last post by AeroShark333 on August 01, 2020, 09:05:57 pm »
No idea what that error should be. Something isn't quite right with the gl state for some reason. I would ignore it for now.
Okay, thank you

And yes, 4 is a hard coded limit. I looked into expanding it once, but decided against it for reasons that I can't remember anymore. Must have been a technical limitation of some kind. There's no way to hack around it, I'm afraid.
I found this post (Reply #1) for a possible reason why: http://www.jpct.net/forum2/index.php?topic=3371.0
Another possible reason I could think of: the minimum amount of vertex attributes is used up.

But I still think it should be possible to increase the limit to at least 8; especially modern devices (I think actually old ones too) should support this.
It is true that vertex shaders have very limited textures to access (minimum of 0).
Though, usually I believe textures are only accessed in the fragment shader (so there should be no problem at all considering the limit for the amount of vertex shader textures).
The amount of textures that can be accessed in the fragment shader is at least 8.

To fix the vertex attributes being used up: merge variables into one bigger variable.
Currently there's 4 texture attributes for the texture coordinates (as seen in: http://www.jpct.net/jpct-ae/doc/com/threed/jpct/GLSLShader.html)
However, these are all vec2's, while they could be vec4's.
4 vec4's could potentially hold texture coordinates for 8 texture stages.
Example:
Code: [Select]
//VERTEX SHADER
...
attribute vec4 texture01;
...
void main(){
    ...
    vec2 texture0 = texture01.xy;
    vec2 texture1 = texture01.zw;
    ...
}

According to the OpenGLES2 spec: https://www.khronos.org/registry/OpenGL/specs/es/2.0/es_cm_spec_2.0.pdf (page 66 of documentation; page 71 of PDF)
StateMinimum value
MAX VERTEX TEXTURE IMAGE UNITS0
MAX TEXTURE IMAGE UNITS8
MAX VERTEX ATTRIBS8

I suppose it'd be a quite a challenge to be rewriting this so I'm not sure if it's too much to ask for.
I'd have wanted to give it a shot if jPCT-AE was open-source but yeah...
Otherwise, would it be possible to add something more hacky so I'd still be able to bind these textures to the Object3D (and its GLSLShader) from stage 5 to 8?
A TextureBindingHook or something for additional texture stages, something like:
Code: [Select]
TextureInfo blah ... // first 4 textures go here
obj.setTexture(blah);

obj.setTextureBindingHook(new TextureBindingHook(){
    @Override
    public void beforeFinishedBinding(){
        Texture tex = fifthTex;
        int stage = 5;
        String variableName = "textureUnit4";
        methodToBind(tex, stage, variableName);
    }
});
(Additional texture coordinates attributes I don't really need; but only being able to access the textures in the fragment shader)
12
Support / Re: Increase number of texture units
« Last post by EgonOlsen on August 01, 2020, 06:10:42 pm »
No idea what that error should be. Something isn't quite right with the gl state for some reason. I would ignore it for now.

And yes, 4 is a hard coded limit. I looked into expanding it once, but decided against it for reasons that I can't remember anymore. Must have been a technical limitation of some kind. There's no way to hack around it, I'm afraid.
13
Bones / Re: BonesIO Question
« Last post by AGP on August 01, 2020, 08:36:32 am »
I made the SkinClips work (in the sense that they're filled properly) by making a custom serializer and deserializer for them. But now I'm getting the same instancing issue with Skeletons. So I wrote the hacky method below and called it at the very end of the appropriate AnimatedGroup constructor. Now when I comment out the if (skeleton != pose.skeleton) test in SkinClip.applyTo(...), my model gets all bunched-up once, then doesn't animated at all (but doesn't crash, either) again.

Code: [Select]
private void attemptSkeletonInstanceFix() {//Gson Skeleton instance crap
     SkinClip lastClip = skinClipSequence.getClip(0);
     if (lastClip.getSkeleton().equals(objects[0].getSkeleton()) && lastClip.getSkeleton() != objects[0].getSkeleton()) {
lastClip.skeleton = objects[0].getSkeleton();
     }
     for (int i = 1; i < skinClipSequence.getSize(); i++) {
if (lastClip.getSkeleton().equals(skinClipSequence.getClip(i).getSkeleton()) && lastClip.getSkeleton() != skinClipSequence.getClip(i).getSkeleton())
     skinClipSequence.getClip(i).skeleton = lastClip.getSkeleton();
lastClip = skinClipSequence.getClip(i);
     }
     for (Animated3D object : objects)
object.currentPose.skeleton = objects[0].getSkeleton();
}
14
Bones / Re: BonesIO Question
« Last post by raft on July 30, 2020, 10:21:37 am »
Difficult to make a comment without knowing how you are actually importing/reading the data.
15
Bones / Re: BonesIO Question
« Last post by AGP on July 29, 2020, 10:31:48 pm »
I'm stuck, now, at an Exception in thread "main" com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: there is already a channel for joint 84. But I'm serializing the data as-is. I wonder if it's related to the potentially null instances of JointChannel in SkinClip.iterator().
16
Support / Increase number of texture units
« Last post by AeroShark333 on July 29, 2020, 06:55:13 pm »
I received a crash from an user with the following stacktrace:
Code: [Select]
java.lang.RuntimeException:
  at com.threed.jpct.Logger.log (Logger.java:206)
  at com.threed.jpct.GL20.checkError (GL20.java:163)
  at com.threed.jpct.GL20.glGenBuffers (GL20.java:1385)
  at com.threed.jpct.CompiledInstance.compileToVBO (CompiledInstance.java:1478)
  at com.threed.jpct.CompiledInstance.render (CompiledInstance.java:606)
  at com.threed.jpct.GLRenderer.drawWireframe (GLRenderer.java:2552)
  at com.threed.jpct.World.draw (World.java:1424)
  at com.threed.jpct.World.drawWireframe (World.java:1132)
  at com.aeroshark333.artofearthify.lw.ArtOfEarthify$34.run (ArtOfEarthify.java:1492)
  at com.aeroshark333.artofearthify.utils.WorkerThread$2.run (WorkerThread.java:46)
  at com.aeroshark333.artofearthify.lw.ArtOfEarthify.onDrawFrame (ArtOfEarthify.java:1681)
  at com.aeroshark333.artofearthify.lw.LiveWallpaperRenderer.onDrawFrame (LiveWallpaperRenderer.java:73)
  at android.opengl.GLSurfaceView$GLThread.guardedRun (GLSurfaceView.java:1553)
  at android.opengl.GLSurfaceView$GLThread.run (GLSurfaceView.java:1253)
Any idea what this could be? I've only received this once so maybe it could be ignored...

PS: The question is unrelated to the original thread but I thought the topic title suited... so...

PPS: Although jPCT has Config.maxTextureLayers, the hard limit seems to be 4. Would it be possible to increase this value to 8 (or arbitrary)? Or assign these extra textures using a hack or something? I'd like to be able to access 8 textures in my fragment shader in a single pass
17
Bones / Re: Moved to GitHub
« Last post by EgonOlsen on July 21, 2020, 05:32:46 pm »
Will do when I'm back from holiday. If I don't, please remind me again... ;)
18
Bones / Moved to GitHub
« Last post by raft on July 19, 2020, 07:23:33 pm »
Source code of Bones moved to GitHub.
https://github.com/raftAtGit/Bones.

The latest downloadable zip file can be found at releases page.

Of course this doesnt mean, Bones is moving away from jPCT community. It's a library for jPCT after all :)

The primary feedback and question medium will still be jPCT forums as mentioned in the feedback section.

This was something I wanted to do since long time, to get rid of the burden of keeping the source code safe. Cloudforge, the previous host of Bones' code is closing, so this looked like the proper time to do that.

Egon, can you please update the links :)
19
Bones / Re: BonesIO Question
« Last post by AGP on July 17, 2020, 08:34:02 am »
Thanks for replying. My problem is Gson's fault. Clean, near-identical to yours, code produced a perfect model, loaded quickly, but with many copies of the same Skeleton. It turns out that Gson doesn't do instances very well. I'm working on a registerTypeAdapterFactory solution which is producing NullPointerExceptions for SkinClipSequences (but for no other class, including Skeleton and SkeletonPose). I also tried Jackson with no success, so I returned to Gson. I expect to succeed soon, and I will post the sources for BonesIO, AnimatedGroup and Animated3D here.
20
Bones / Re: BonesIO Question
« Last post by raft on July 16, 2020, 06:56:49 pm »
sorry for the late answer, somehow I didnt receive the notification email.

BonesIO class reads and writes using Java serialization. Java serialization preserves objects references.

So, as long as SkinClips and SkinClipSequences share the same Skeleton instance when they are written by BonesIO, they will share the same Skeleton instance when read by BonesIO.

Pages: 1 [2] 3 4 ... 10