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 - Windmiller

#1
Hi

About multithreading; I am using threading in this manner..

Thread 1: Calculating half of everything that is not graphics, but only the parts of graphics for flagging if objects should be visible or not.
Thread 2: Calculating the other half of everything that is not graphics, but only the parts of graphics for flagging if objects should be visible or not.
Thread 3: Checking what 3D objects that are flagged to be loaded and do that with the Loader.
JPCT-AE: The jpct´s graphics thread, displaying all the objects that should be visible, if flagged that they should not be visible it removes them.
Firebase: The Firebase real time database thread, storing and loading from the database.

I am creating a big multiplayer space game with over 200 planets that you can dock at and walk around, build stuff, dimensions that brings the players to mazes where they can find things they´ll need and hide things by building blocks around them. This method was the only way to use several threads, and it even runs on crappy phones too because of the way things are loaded, unloaded and removed from visible depending on where the player is in the world.

More multithreading than this is not needed, it will only complex things for you and might even slow things down.
That is my point of view.

#2
Support / Re: jPCT(-AE) origins
December 10, 2021, 11:47:35 PM
Hi

That would be awesome, really nice.
Understand completely, take your time.

Regards, M
#3
Support / jPCT(-AE) origins
December 08, 2021, 10:38:19 PM
Quote from: AeroShark333 on December 08, 2021, 03:08:56 PM
Quote from: Windmiller on December 07, 2021, 11:16:46 AMIs it Helge Foerster who made the engine?

I've decided to send a mail to the info address instead with these questions.

Thanks again :)
Seems so... https://www.jpct.net/imprint.html
Most likely also the very person you've been talking with hehe

Quote from: Windmiller on December 07, 2021, 11:16:46 AM
Thanks a bunch for all the help and support, and the engine is wonderful by the way I think I've never mentioned it before.
Is there somewhere I can read of how, when and why the engine came to be? It would be very interesting to read and know more about the background, there's a lot of information about it to read but I don´t think I've seen anything about that.
Would be interesting to know indeed

Aaaa hehe that's cool, I was uncertain because to me Egon Olsen is a Danish or Norwegian name so I though Egon was from somewhere around up here (Sweden). But apparently he was from the country down beneath instead and it was just a sidekick username then :D

And yes it would be interesting to know more.
#4
Support / Re: ShadowHelper and special Textures
December 07, 2021, 11:16:46 AM
Thanks a bunch for all the help and support, and the engine is wonderful by the way I think I've never mentioned it before.
Is there somewhere I can read of how, when and why the engine came to be? It would be very interesting to read and know more about the background, there's a lot of information about it to read but I don´t think I've seen anything about that.

Is it Helge Foerster who made the engine?

I've decided to send a mail to the info address instead with these questions.

Thanks again :)
#5
Support / Re: ShadowHelper and special Textures
December 07, 2021, 09:35:03 AM
When I added the following config..


Config.maxTextureLayers = 3;


Then it was working! :O
Could not set it to anything less than 3

Default was 2, and does that mean that the shadow itself counts as 1?
Because I'm only adding 2 myself..

Or is it tricked to calculate the baked texture in the sphere´s file from Blender as the third one, even though it´s just the name of a texture in there, its an .obj file by the way.
#6
Support / Re: ShadowHelper and special Textures
December 07, 2021, 09:15:01 AM
Since it's not a test case but a big game, there are a lot of things going on.
I guess I will have to set up a test case first but something that struck me while looking at the log was the following lines..


12-07 08:52:44.028 6572-6643/com.storyofagame.vast I/jPCT-AE: Loading /shadowFragmentPostPCFEF.src
12-07 08:52:44.031 6572-6643/com.storyofagame.vast I/jPCT-AE: Loading file from InputStream
12-07 08:52:44.031 6572-6643/com.storyofagame.vast I/jPCT-AE: Text file from InputStream loaded...1604 bytes
12-07 08:52:44.032 6572-6643/com.storyofagame.vast I/jPCT-AE: Loading /shadowFragmentPostTex0PCFEF.src
12-07 08:52:44.034 6572-6643/com.storyofagame.vast I/jPCT-AE: Loading file from InputStream
12-07 08:52:44.035 6572-6643/com.storyofagame.vast I/jPCT-AE: Text file from InputStream loaded...934 bytes
12-07 08:52:44.035 6572-6643/com.storyofagame.vast I/jPCT-AE: glGetIntegerv(3379, java.nio.ByteBufferAsIntBuffer[position=0,limit=16,capacity=16]) took 56094ns
12-07 08:52:44.036 6572-6643/com.storyofagame.vast I/jPCT-AE: This device supports up to 16384*16384 textures!
12-07 08:52:44.037 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564037 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.037 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564037 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.037 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564037 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.037 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564037 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.037 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564037 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.037 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564037 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.037 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564037 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.037 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564037 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.037 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564037 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.037 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564037 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.037 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564037 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.038 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564038 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.038 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564038 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.038 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564038 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.038 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564038 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.038 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564038 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.038 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564038 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.038 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564038 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.038 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564038 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.038 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564038 ] - WARNING: No further texture stage available (2/1/2)!

Repeating

12-07 08:52:44.063 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564063 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.063 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564063 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.063 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564063 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.063 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564063 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.063 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564063 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.063 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564063 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.063 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564063 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.063 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564063 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.063 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564063 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.063 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564063 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.063 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564063 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.063 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564063 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.063 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564063 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.063 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564063 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.063 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564063 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.063 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564063 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.063 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564063 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.063 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564063 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.063 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564063 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.063 6572-6643/com.storyofagame.vast W/jPCT-AE: [ 1638863564063 ] - WARNING: No further texture stage available (2/1/2)!
12-07 08:52:44.064 6572-6643/com.storyofagame.vast I/jPCT-AE: glEnable(3089) took 68646ns
12-07 08:52:44.065 6572-6643/com.storyofagame.vast I/jPCT-AE: glScissor(1, 1, 1022, 1022) took 106667ns
12-07 08:52:44.075 6572-6643/com.storyofagame.vast I/jPCT-AE: glGenTextures(1, java.nio.ByteBufferAsIntBuffer[position=0,limit=1,capacity=1]) took 87188ns
12-07 08:52:44.075 6572-6643/com.storyofagame.vast I/jPCT-AE: glBindTexture(3553, 9) took 54479ns
12-07 08:52:44.075 6572-6643/com.storyofagame.vast I/jPCT-AE: glTexParameterx(3553, 10241, 9729) took 22969ns
12-07 08:52:44.075 6572-6643/com.storyofagame.vast I/jPCT-AE: glTexParameterx(3553, 10240, 9729) took 14375ns
12-07 08:52:44.075 6572-6643/com.storyofagame.vast I/jPCT-AE: glTexParameterx(3553, 10242, 10497) took 11563ns
12-07 08:52:44.075 6572-6643/com.storyofagame.vast I/jPCT-AE: glTexParameterx(3553, 10243, 10497) took 10677ns
12-07 08:52:44.092 6572-6643/com.storyofagame.vast I/jPCT-AE: glTexImage2D(3553, 0, 6408, 1024, 1024, 0, 6408, 5121, java


It was spitting out lines every millisecound so it was hard to catch anything before the log was overfilled.
Therefore I will need to create a test case for better viewing of the log file.
#7
Support / Re: ShadowHelper and special Textures
December 06, 2021, 11:55:11 PM
Ok, so if I understand, it should be in this order.

1. Load the sphere
2. call my setTexture function
3. add sphere to world
3. Load the Primitives.getCube
4. add cube to the world
5. create ShadowHelper instance
6. set up the shadowhelper, sphere as a receiver and the cube as a caster
7. followed by the following


shadowHelper.updateShadowMap(buffer, world);

buffer.clear(back);
world.renderScene(buffer);
world.draw(buffer);

buffer.display();


This is the order that I'm doing this in, without seeing any shadows sadly :/

EDIT: It works if I remove the splatting texture


// Assign the splatting texture...
ti.add(bid, -(v0.x - minX) / dxs, (v0.y - minY) / dys, -(v1.x - minX) / dxs, (v1.y - minY) / dys, -(v2.x - minX) / dxs, (v2.y - minY) / dys, TextureInfo.MODE_ADD)


Which means that something is happening when going into multi texture?
This must actually happen to everyone.
#8
Support / ShadowHelper and special Textures
December 04, 2021, 01:49:29 PM
Hi,

The problems seems to be piling up for me now, don't know why.

I added a ShadowHelper and added a Sphere as a receiver and a Primitives.getCube as a caster placed just over the surface of the Sphere, the sphere is made in Blender.

Everything is working and I've made the shadow visible like it should be, but that's only if I'm applying the sphere's texture directly with the following code..


sphere.setTexture("entityTexturePlanet");


From there everything is just fine, but if I'm using the following method to add the texture..


setTexture(sphere);


Calling the following function..


private static void setTexture(Object3D obj) {
        TextureManager tm = TextureManager.getInstance();

        obj.calcBoundingBox();

        float[] bb = obj.getMesh().getBoundingBox();

        float minX = bb[0];
        float maxX = bb[1];
        float minY = bb[2];
        float maxY = bb[3];
        float dx = maxX - minX;
        float dy = maxY - minY;

        float dxs = dx;
        float dys = dy;

        dx /= 20f;
        dy /= 20f;

        float dxd = dx;
        float dyd = dy;

        int tid = tm.getTextureID("entityTexturePlanet");
        int bid = tm.getTextureID("ice");

        PolygonManager pm = obj.getPolygonManager();
        for (int i = 0; i < pm.getMaxPolygonID(); i++) {

            SimpleVector v0 = pm.getTransformedVertex(i, 0);
            SimpleVector v1 = pm.getTransformedVertex(i, 1);
            SimpleVector v2 = pm.getTransformedVertex(i, 2);

            // Assign textures for the first three layers (the "normal"
            // textures)...
            TextureInfo ti = new TextureInfo(tid, v0.x / dx, v0.y / dy, v1.x / dx, v1.y / dy, v2.x / dx, v2.y / dy);

            // Assign the splatting texture...
            ti.add(bid, -(v0.x - minX) / dxs, (v0.y - minY) / dys, -(v1.x - minX) / dxs, (v1.y - minY) / dys, -(v2.x - minX) / dxs, (v2.y - minY) / dys, TextureInfo.MODE_ADD);
            pm.setPolygonTexture(i, ti);
        }


Then the shadow totally disappears, this also happens if I'm using the bump map example that I've previously found..


TextureManager tm = TextureManager.getInstance();

                    Texture face = new Texture(res.openRawResource(R.raw.face2));
                    Texture normals = new Texture(res.openRawResource(R.raw.face_norm), true);
                    Texture heighty = new Texture(res.openRawResource(R.raw.face_height2));

                    TexelGrabber grabber = new TexelGrabber();
                    heighty.setEffect(grabber);
                    heighty.applyEffect();
                    int[] heighties = grabber.getAlpha();

                    AlphaMerger setter = new AlphaMerger(heighties);
                    normals.setEffect(setter);
                    normals.applyEffect();

                    tm.addTexture("face", face);
                    tm.addTexture("normals", normals);

                    TextureInfo ti = new TextureInfo(TextureManager.getInstance().getTextureID("face"));
                    ti.add(TextureManager.getInstance().getTextureID("normals"), TextureInfo.MODE_BLEND);

                    // Calculate for texturing..
                    sphere.calcTextureWrapSpherical();

                    sphere.setTexture(ti);

                    sphere.compile();
                    sphere.build();


Must be something that I'm not thinking of here? :/
Is these two later methods overwriting the shadow map? What is going on here?

Regards,
#9
Now I'm getting somewhere.. but not quite enough :(

I'm using this code


private static void setTexture(Object3D obj) {
        TextureManager tm = TextureManager.getInstance();

        obj.calcBoundingBox();

        float[] bb = obj.getMesh().getBoundingBox();

        float minX = bb[0];
        float maxX = bb[1];
        float minZ = bb[4];
        float maxZ = bb[5];
        float dx = maxX - minX;
        float dz = maxZ - minZ;

        float dxs = dx;
        float dzs = dz;

        dx /= 10f;
        dz /= 10f;

        float dxd = dx;
        float dzd = dz;

        int tid = tm.getTextureID("entityTexturePlanet");
        //int sid = tm.getTextureID("rocks");
        //int trid = tm.getTextureID("sand");
        //int bid = tm.getTextureID("splat");

        PolygonManager pm = obj.getPolygonManager();
        for (int i = 0; i < pm.getMaxPolygonID(); i++) {
            SimpleVector v0 = pm.getTransformedVertex(i, 0);
            SimpleVector v1 = pm.getTransformedVertex(i, 1);
            SimpleVector v2 = pm.getTransformedVertex(i, 2);

            // Assign textures for the first three layers (the "normal"
            // textures)...
            TextureInfo ti = new TextureInfo(tid, v0.x / dx, v0.z / dz, v1.x / dx, v1.z / dz, v2.x / dx, v2.z / dz);
            //ti.add(sid, v0.x / dxd, v0.z / dzd, v1.x / dxd, v1.z / dzd, v2.x / dxd, v2.z / dzd, TextureInfo.MODE_ADD);
            //ti.add(trid, v0.x / dxd, v0.z / dzd, v1.x / dxd, v1.z / dzd, v2.x / dxd, v2.z / dzd, TextureInfo.MODE_ADD);

            // Assign the splatting texture...
            //ti.add(bid, -(v0.x - minX) / dxs, (v0.z - minZ) / dzs, -(v1.x - minX) / dxs, (v1.z - minZ) / dzs, -(v2.x - minX) / dxs, (v2.z - minZ) / dzs, TextureInfo.MODE_ADD);
            pm.setPolygonTexture(i, ti);
        }
    }


It's your code Egon, but it's quick and dirty and I'm only using one texture in it and changed the image to a sandy image, with the size 512x512.
It looks fine most of the sphere but there's a border going 360 around the sphere as seen in the image. (the image is pretty dark but I hope you'll see what I'm talking about here)

How can I solve this big bad border on my sphere?
What is it that I'm not understanding here, scratching my head.
I know it has something to do with that my object is a Primitives.getSphere(..); but hmm

Thanks in advance

I've learnt something from this thread https://www.jpct.net/forum2/index.php/topic,2190.msg16243.html#msg16243
And that's that the Primitives UV are kind of basic. But I still got the border :(
It seems that the code I'm using is for flat surfaces only? Doesn't make it right for a sphere.

I have a perfect Sphere with UV mapped textures in it that I've made in Blender, is there a way to apply multi textures to these UV coordinates with a function like yours Egon? So that I programmatically can add "Splatter Texture" to it?
#10
Hi, and thanks!

You´re great, both of you, thanks a lot really appreciate your help :)
Makes sense, I'll try this.

#11
But what about tiling textures, repeating a small one instead of stretching them out? I found a function that seems to belong to this and that's the Texture.setClamping()??
Or do I have to map it myself in like Blender, isn't it possible to do without special UV coords made in Blender? I mean I can´t test this with the Primitives objects?

Regards
#12
Thanks for all the information, it will definitely be useful, a great useful read. Mipmap was a long time ago so I will need to read a more about that to bring the memories back. Thanks again :)
#13
Hi!

I was thinking about different approaches to load low res textures to apply on a 3D object that is far away and load and apply high res when getting closer, but how to know what size of texture the device can handle before getting out of memory or something like that?
Someone who has an idea, and would like to think me in the right direction.
Should I use and count on the different resolution "res" folders in Android or is there a better solution?

Regards..
#14
Hello

Ok, yes overcomplicated is the right word as I can recall it.
Then it will still live on for a great while, good to know.

Thanks

Regards, Morgan
#15
Hi!

Is JPCT going to be updated to meet the LWJGL V3.X ??
Because some functions that the desktop version of JPCT is using have been lifted out of the LWJGL since V2.* like the Display (and other functions).

JPCT is not working because of the functions that were in LWJGL V2.X are not included anymore and have been changed into newer better ones, more efficient in LWJGL V3.X.

So my question is, are JPCT not going to continue to live?

Anybody?

Regards,

Morgan