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

#91
Support / RenderToTexture and alpha blending problem
March 28, 2020, 02:37:44 PM
hi Egon,
i encounter a strange problem.
i want to render some clouds into textures and put them into rectangle meshes then put them back to the scene. the replaced method is putting the clouds directly into the scene.
there is a far scene where nothing but clouds are in, and the far scene is rendered without depth test/depth write.
i believe the environment for rtt is the same as the non rtt one - same shader, same depth test setting.
but the rtt texture doesnt look the same.
without rtt, the overlapping particles blend, the result looks thick. but with rtt it seems only one layer remains, which indicates a replace method rather than blending.
and even if the rtt texture has opaque background, the particles make the texture look-through. the below screenshots are comparison of 2 methods .
the large white area is because i clear the rtt fb with color 0xffffffff, which is not necessary, but it indicates the opaque background was lost because of the particles. i also tried to use an opaque mesh as background, same result.
turning depth test on, doesnt change the result either.
the texture for rtt is created with Texture(x,y) method.
more strangely, the main scene is also rendered into a texture(npot) then blit into the true fb, but the clouds directly in main scene doesnt change the npot texture to transparent.

why would the rtt result be different from directly rendering into the main scene?

#92
Projects / Re: my project - Vehicle Simulation
March 19, 2020, 08:24:44 PM
you are mostly right.
but there is no filter, the location of particles are random and they are transparent, somewhere it's thicker or thinner so the blended color varies even with just white color. the bottom is set to grey, yes.
the theory is quite simple.
the good side is, little texture is needed, and it has 3D shape. the bad side is, slower, and does not look very real.

#93
Projects / Re: my project - Vehicle Simulation
March 16, 2020, 06:07:38 PM
clouds , made of groups of randomly placed particles , rendered using a shader.
#94
Support / render thread question
March 15, 2020, 09:50:38 AM
hi Egon,
when World.draw() returns, has GL finished drawing? or is it still working when my program does other work?
does framebuffer.display() finish all render work before return?
#95
what a pity.
thanks anyway.
#96
i tested repeatRendering. it seems that setOrigin doesn't work at that moment. setFloatArrayUniform works though.
so if i still want to use repeatRendering, i have to change the shader to take object position into account.
i prefer using multiple object3d's, as adding 3 floats on each vertex seems less efficient.
#97
also there is another question: can a shader be applied to Object3D's in multiple World's ?

Thanks in advance.
#98
i plan to use a renderhook and a shader to draw an object3D multiple times.
in repeatRendering, pseudo code:

if id>0 { id-=1; myobject.setOrigin(positionArray[id]); myshader.setUniform(uniformArray[id]); return true; }
return false;


if this doesnt work, i would use a shader and a renderhook on multiple Object3D`s with the same Mesh.
#99
Projects / Re: my project - Vehicle Simulation
March 04, 2020, 08:02:16 AM
particles , eye candy
#100
Support / Re: how to select uniform in renderhook
January 15, 2020, 06:31:57 AM
thanks, i think these ways can all work.
#101
Support / how to select uniform in renderhook
January 13, 2020, 07:39:23 AM
Hi Egon,
if multiple objects share a shader, i must set a renderhook to apply a uniform to an object. the question is ,how to select the correct uniform to an object?
i have an array of objects and an array of uniforms.
i need an ID for each object right?
currently i use object3d.set/get transparency like an id to select uniforms. it works, but i dont think this is the formal way.
i see object3d.getid, but this id is different from the id in my array. should i map these 2 types of id's? is it the formal way to select uniforms?

thanks for your support.
#102
Feedback / Re: jPCT Still Going
December 07, 2019, 08:06:09 PM
i am still using jpct-ae for my personal project, and i don't intend to switch to other engines. because it's convenient to use - i write code and test run on an android device, no need for PC most of the time.
#103
Support / Re: Scale X and Y axis
July 21, 2019, 06:04:24 PM
i tested it on jpct-ae only,  openglES 2.0
#104
Support / Re: Scale X and Y axis
July 19, 2019, 06:57:34 PM
Quote from: EgonOlsen on February 01, 2019, 08:30:14 AM
Apart from that: We are talking about Android/jPCT-AE here? In that case, you can't do it this way unless some more setup work which might not be worth it. There's another way, though. You can tweak the rotation matrix directly. This has some drawbacks as well, in particular it might increase a light source's brightness on the scaled object when it shouldn't and it doesn't work well together with the build-in scale methods. Anyway, this is how it works:


Matrix scale=new Matrix();
scale.set(0, 0, 2); // 0,0 for x-axis scaling, 1,1 for y, 2,2 for z
obj.getRotationMatrix().matMul(scale);


If you otherwise don't change the rotation matrix, you only have to apply this once. If you set it to a new anyway in each frame (or even sometimes), you have to apply this afterwards. Also keep in mind that scaling is cumulative. That means that doing this by 2 and then by 3 will result in a scaling of 6.

hi Egon, i read this thread and remember that i used to tried lengthening the normal vector to change lighting effect (over bright effect ? :) ) , i did that when meshes were created from vertex info, such as multiplying the normal by 5. but the lighting didnt change at all, seems like the normal vector is normalized when rendering.
can this behavior of normalizing the normal vector be canceled?
i was just exploring possibilities.
#105
Support / Re: about the strength of specular light
February 16, 2019, 07:22:07 PM
yes , it works