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.


Messages - AeroShark333

Pages: [1] 2 3 ... 21
1
Support / Re: Disable cameraLookAt
« on: January 13, 2023, 07:19:15 pm »
I'd temporarily store/clone the RotationMatrix of the camera on the moment you enable the freecam. This means you'll have the last known camera rotation matrix which was used when the camera used #lookAt(...). Then instead of doing #lookAt(distantDummy), you do #setRotationMatrix(temporaryMatrix)

2
Support / Re: raspberry pi, orange pi, etc
« on: December 04, 2022, 03:00:18 pm »
Afaik, you can even run Android on a Raspberry Pi which has proper OpenGLES support. In that case jPCT-AE could be used.
But then again, I would argue that you can make jPCT work on a Linux distro too (Raspbian or such). I would believe that there should be some sort of OpenGL support available as for how popular the Raspberry Pi is. It might not work as seamlessly as on Windows but I wouldn't know for sure until someone tried :D

3
Support / Re: How to display 2D image to 3D screen
« on: November 22, 2022, 03:05:15 pm »
Thank you, its working, i didn't have the perfect texture though  ::) ::)
Glad to hear!

For a joystick, I'd recommend a PNG file as texture (where the outside is transparent), otherwise a JPG texture (where the outside is black).
Make sure to use the constructors in Texture that have 'useAlpha' (which you should then set to true): https://www.jpct.net/jpct-ae/doc/com/threed/jpct/Texture.html#Texture-Bitmap-boolean-

4
Support / Re: How to display 2D image to 3D screen
« on: November 21, 2022, 10:27:21 pm »
Hello welcome!

Hello friends. How to display 2D Image to the camera?
I'am trying to make a Joystick
I'd recommend the blitting functions of the FrameBuffer:
https://www.jpct.net/jpct-ae/doc/com/threed/jpct/FrameBuffer.html#blit-com.threed.jpct.Texture-float-float-float-float-float-float-float-float-int-boolean-

I hope this helps :)

5
Support / Re: Bug with diffuse lighting
« on: November 13, 2022, 03:49:43 am »
I tried to modify the test case to something similar as what I had but it seems to be working fine...

I tried to look again at my own situation too but it seems fine now...  ???
I think I just made a mistake myself along the way
Sorry for bringing this up, I guess it was an error on my side after all
I think I forgot to set the intensities for some lights and they showed the wrong color (white by default...)

I'll report back if there was something fishy going on still but I suppose it is not the case; so... case closed for now

6
Support / Re: Bug with diffuse lighting
« on: November 09, 2022, 04:00:05 pm »
Thank you!

7
News / Re: Maintainability
« on: November 09, 2022, 02:35:28 am »
Thanks.

I'm thinking adding some more ExtendedPrimitives as Polyhedron shapes. But regarding your license this is not possible.

You could always implement such extension of general primitive Object3D's (in a new seperate class) yourself (and share them here for others) ;)

8
Support / Bug with diffuse lighting
« on: November 09, 2022, 02:33:03 am »
Hello,

I have noticed a minor bug while working on something.

Bug: It seems that the "diffuseColors" are not all set properly.
For the first two light sources the colors seem fine, but for 3 and 4 (and possibly till 8 ), the diffuseColor seems white instead of the color supplied through #setIntensity(R,G,B).
I have tried to use the "diffuseColors" from 1&2 for 3&4 by changing the default shader code. And this seems to be working as intended.
So my suspect is that in the Java code of the library, the diffuse colors are not set to the uniform "diffuseColors" properly.

Thanks in advance! :)

9
Support / Re: 3Dto2D
« on: July 24, 2022, 07:08:03 pm »
I see two possibilities:
1.
I'd first loop over all Object3D's in the world.
Then see which of these Object3D's are in the camera's FOV.
(Easiest way would be to do a dot product with the camera direction and the vector connecting the camera to each Object3D; then let's say > 0 falls in the camera view and < 0 is behind the camera's view.)

Then next, using the Object3D's in the camera's view, you'll be using polygon manager. https://www.jpct.net/jpct-ae/doc/com/threed/jpct/PolygonManager.html
You'll have something like this:
Code: [Select]
final Object3D obj = ...;
PolygonManager objPM = obj.getPolygonManager();
for(int id = 0; id < objPM.getMaxPolygonID(); id++){
if(objPM.getTransformedNormal(id).y > 0){
// ^Check if normal of polygon points up...
// Change if this doesn't work
SimpleVector v1 = objPM.getTransformedVertex(id, 0);
SimpleVector v2 = objPM.getTransformedVertex(id, 1);
SimpleVector v3 = objPM.getTransformedVertex(id, 2);
float maxHeight = Math.max(Math.max(v1.y, v2.y), v3.y);
// Do whatever with the max height of this polygon face
}
}
I sort of assumed here that the camera is looking down in the y-axis...

2. Shoot rays for every pixel on the screen and see with which Object3D and polygon face it interacts with. Then use the PolygonManager again to get the distance to that polygon (by averaging vertices or something)...
Make sure the algorithm is RAY:
https://www.jpct.net/jpct-ae/doc/com/threed/jpct/CollisionEvent.html
Maybe the code in reply #19 can help you with ray-polygon intersection:
https://www.jpct.net/forum2/index.php/topic,4821.msg32989.html#msg32989
It's up to you whether you want the ray to be from the camera's origin or parallel to the camera's direction...
To get the 3D position of the screen plane, I think you should use "reproject2D3DWS" in Interact2D. Then you can shoot a ray with vector "normalize((3D position of screen plane) - (camera position))"...
For ray-polygon picking, I think this might be useful: https://www.jpct.net/wiki/index.php/Picking and https://www.jpct.net/doc/com/threed/jpct/World.html#calcMinDistance(com.threed.jpct.SimpleVector,%20com.threed.jpct.SimpleVector,%20float)

Sorry for this messy explanation; typing on phone isn't ideal...

10
Support / Re: How to add more texture maps to obj
« on: June 10, 2022, 04:31:03 pm »
In Blender, try to import the model.
Then in top-left of your screen, change from Object Mode to Edit Mode.
Press CTRL+T (Triangulate mesh).
And then export this new Mesh as .Obj

(source: https://blender.stackexchange.com/questions/19253/how-to-make-all-polygons-into-triangles)

11
Support / Re: How to add more texture maps to obj
« on: June 04, 2022, 04:36:14 pm »
I believe the general logic should be:
- Load textures with full names
- Load model file
- Load MTL file
- Load 3D object using model and MTL files

If used properly then Object3D#setTexture(...) is not necessary
The model loader will find the texture names that are specified in the MTL file. But these names should be properly set in the texture manager.

Instead of this:
tm.addTexture("_Vegetation_Blur7_1",_Vegetation_Blur7_1);

Try one of these:
tm.addTexture("changjing2/_Vegetation_Blur7_1.jpg",_Vegetation_Blur7_1);

Or:
tm.addTexture("changjing2/_Vegetation_Blur7_1",_Vegetation_Blur7_1);

12
Support / Re: is it possible to make JPCT work with Cesium?
« on: April 08, 2022, 11:07:23 pm »
https://www.cesium.com/why-cesium/3d-tiles/ seems like they use .glTF 3D Objects.
I have used these in the past and converted them to .obj extension using Blender.
I suppose there might be some Java library that can do read-out/convert these .glTF files as well.

Seems like a difficult thing to implement, but doable ;)

13
Projects / Re: my project - Vehicle Simulation
« on: March 30, 2022, 07:33:53 pm »
Hi everyone,
i released a demo of this on moddb, here is the link.
https://www.moddb.com/games/vehicle-simulation
it is not a fun and fast game, there are a lot of texts to read if you want to fly in it. but you can quickly make something move and see the effects - you need keyboard for that.
the moddb page is new, i haven't spent much time on it. just uploaded the file and share with you guys.
I have tried it (Google didn't seem to trust the app but I ignored the warnings and installed it anyway).
I haven't been able to try it a lot because of limited time.
I used a bluetooth keyboard on my phone for the controls.
I'm not really used to these controls yet, so I'll test more later; it would be nice to have an option for different or custom control sets.
(Maybe copy controls from popular games (GTA V) or flight simulators (MS-FS 2020, XPlane, YSFlight, etc.)
It would be nice to have on screen controls too (as it's an Android app)
I liked the visuals, HUDs, GUIs and the menu system.

14
Support / Re: jPCT-AE vs. jPCT (and the future of jPCT-AE)
« on: March 30, 2022, 05:54:47 pm »
Thanks for the replies... (I haven't been actively programming lately due to broken PC so excuse me for the late reply)

Quote
Is https://www.jpct.net/jpct-ae/doc/com/threed/jpct/World.html#setDefaultThread-java.lang.Thread- useful in some scenarios?

Not very likely. jPCT-AE sets is automatically to the main thread (i.e. the thread that created the world instance). If it's set to the wrong thread, all that happens is that more garbage objects will be created. There's no performance benefit in setting it to some other thread except if that thread is the actual thread that does the calculations.
Okay, I guess it is best then to leave it untouched...

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.
Hmmm okay, interesting... so far I have only used multi-threading for texture loading (as it can be very blocking process on the GL-thread from my experience).
I believe it would be good to try using multi-threading more to offload processing but I'm afraid to break something, to have dead-locks, and to get other synchronization issues so that has made me hold back a little.

Thanks both for the replies still

15
Support / Re: About jpct-ae loading Problems with FBX format files
« on: March 30, 2022, 05:46:45 pm »
You can import an FBX file in Blender and export it to OBJ ;)

Pages: [1] 2 3 ... 21