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

#196
Support / blitting problem in rtt
August 31, 2016, 09:31:02 AM
i found if i draw object3d in rtt (with World,Camera), then blitting in rtt had wrong size - much larger.
my rtt texture size is 128x32.
#197
Support / no setDepthBufferWrite?
August 31, 2016, 08:13:16 AM
i have an object (a sky plane, or sky dome) which should not affect depth buffer. but in JPCT-AE there is no setDepthBufferWrite(), so now i have to clear depth buffer after drawing the sky.
it would be better if there is the setting.
also, setDepthBufferTest() could be useful too.
#198
Support / Re: default shader lighting problem
August 31, 2016, 06:11:13 AM
i think using an empty world to reset fov is good enough. just that more operations are done than simply changing the frustum. if cpu speed is high enough, it's ok.
#199
Support / Re: default shader lighting problem
August 30, 2016, 04:33:48 PM
ok, my objects are all compiled, so that i didn't change lightmul in desktop app.
#200
Support / Re: default shader lighting problem
August 30, 2016, 12:27:10 PM
my desktop app has noticeable specular effect.
my desktop app uses hardware GL, so max lightmul is 1 , right?
i didn't set lightmul in it.
#201
Support / Re: default shader lighting problem
August 30, 2016, 11:00:37 AM
i tested the newer version of jar, but i didn't see any specular effect.
my settings specterm=20 specpow=90.
#202
Support / Re: default shader lighting problem
August 30, 2016, 06:06:42 AM
this is test code, you'll see a white square on top left corner and it moves a little.
if your screen has high resolution, maybe it's less noticeable, test screen is 1024x600.

package abc.def;
import com.threed.jpct.*;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.opengles.GL10;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.app.Activity;

public class Sim extends Activity {
   static GLSurfaceView GLview;
   static MyRenderer renderer;
   static FrameBuffer fb;
   static World world=new World();
   static Camera cam=world.getCamera();
   static Texture tex;
   static float fov=0.1f;

   protected void onCreate(Bundle a) {
      super.onCreate(a);
      renderer=new MyRenderer();
      GLview=new GLSurfaceView(getApplication());
      GLview.setEGLContextClientVersion(2);
      GLview.setRenderer(renderer);
      setContentView(GLview); }
   @Override
   protected void onPause() { super.onPause(); GLview.onPause(); }
   @Override
   protected void onResume() { super.onResume(); GLview.onResume(); }
   @Override
   protected void onStop() { super.onStop(); }

   class MyRenderer implements GLSurfaceView.Renderer {
      public void onSurfaceCreated(GL10 g,EGLConfig c) {}
      public void onSurfaceChanged(GL10 g,int w,int h) {
         if (fb!=null) fb.dispose();
         fb=new FrameBuffer(w,h);
         cam.setFOVLimits(0.0001f,10f);
         cam.setClippingPlanes(0.1f,100f);
         tex=new Texture(1,1,new RGBColor(200,200,200));
         TextureManager.getInstance().addTexture("tex",tex);
      }
      public void onDrawFrame(GL10 g) {
         fb.clear(); cam.setFOV(fov);
         fov-=0.001f; if (fov<0.01) fov=0.1f;
         world.renderScene(fb); world.draw(fb);
         fb.blit(tex,0,0,10,10,0,0,80,80,-1,false);
         fb.display(); }
   }
}
#203
Support / Re: default shader lighting problem
August 29, 2016, 10:10:14 AM
also , i found a problem with blitting.
if before blitting, the fov is very small (say 0.05 rad), the blit result is inaccurate - text distorted/biased.
can you reset the fov to a normal figure before blitting?
i use an empty world to reset the fov as a temperary solution for now.
#204
Support / Re: default shader lighting problem
August 29, 2016, 10:02:12 AM
great! thanks!
will you fix it based on the version with correct camera nearclip/farclip/fov settings?
#205
Support / Re: default shader lighting problem
August 29, 2016, 09:44:43 AM
i found it was setSpecularLighting(true) that cause the problem.
but even if specpow=0 specterm=0 , the problem is still there.
here is a screenshot without specular.
#206
Support / default shader lighting problem
August 29, 2016, 04:13:03 AM
i have a JPCT app ported to JPCT-AE. i see a grey object with default shader has color problem. its faces are either grey or total black according to light direction, look like very much overbrighted.
my device has PowerVR540 GPU and Android 4.2.2.
what could be the cause?
#207
my approach is just using projective texture, except the receiver is a seperate small simple  object3d instead of a large complex object3d.
i found i could clear the alpha channel of rtt by a full window quad mesh with shader: gl_fragcolor=vec4(0,0,0,0)
then i can draw opaque object in the rtt.
using shader to render the receiver without alpha information can work too.
#208
i am trying to make fake shadow. my approach is like this:
stick a transparent mesh on an object3D which should be a shadow receiver, but in fact the transparent mesh is the receiver;
render the shadow caster object into a texture and project the texture onto the transparent mesh;
the RTT should have alpha information - the part covered by shadow caster is opaque and black, other part is fully transparent.

now i wonder how to render into the alpha channel of RTT texture - i want to use openGL hardware framebuffer for the RTT task (faster) so the texture should be directly used in GPU (not downloaded for further process).
is setAsShadowMap() meant for this?
#209
Support / Re: fog formula?
August 19, 2016, 09:10:43 AM
i found the fixed function pipeline just uses linear fog. any other curve that i tried doesn't match in the render result.
#210
Support / fog formula?
August 18, 2016, 06:53:59 PM
some parts of my scene are rendered with shader while some are not.
i need to know the formula of fog in GL's fixed function rendering and use it in shader so that all parts in the scene have the same fog effect.
i use these settings on the parts without shader:
setFogging(1);
setFoggingMode(1);
setFogParameter(100f,20000f, r,g,b)