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

#1
   Very Nice Progress !  :) THe texture set at upper right corner and lower left corner are pretty realistic!In fact the one at the upper right corner feels quite creepy ! I wont like to dwell there in real life  ;)! The bumpmap is prominent in both these two. I think the red one(lower right corner) can be tweaked more ?
Whatever,....Your project inspires a lot ! You do it all alone.....It must be quite hard  to do all the graphics and coding, debugging etc...?
#2
News / Re: Happy Birthday, jPCT-AE!
March 04, 2015, 06:15:53 AM
Congratulation jpct and EgonOlsen!!! and also to the jpct community !!
It has come a long way! and I wish a good luck to you and jpct project and hope that it will help many countless  developers in future  :).
Those facts were really good to know !
I did not knew that jpct-ae is also used  by Google, Samsung, Texas Instruments, Intel, BEUMER Group, Autodesk!.  Just curious .... what type of project? Are they available in public in some form?
#3
    I am using the shadow mapping example  provided by Egon (Thanks again!) . I experimented a little
and then tried to update light position and direction in real time. But somehow  I was not able to see any changes in the shadowmap blit and the scene too ,when I changed the position and direction of light(I am using directional light present in Thomas' sampls ) .
#4
    Thank You EgonOlsen!! For posting exaple  And also for explaining the basic shadow mapping process.****You really help a lOT!  :)******
I'll try this ! :)
#5

Means like this?

public static void renderWithShader(World world, FrameBuffer fb, GLSLShader shader) {
Enumeration<Object3D> objects = world.getObjects();
while (objects.hasMoreElements()) {
Object3D obj = (Object3D) objects.nextElement();
if (obj.getVisibility()) {
GLSLShader objShader = obj.getShader();
shaders.add(objShader);
obj.setShader(shader);
}
}

world.renderScene(fb);
world.draw(fb);
objects = world.getObjects();
int i = 0;
while (objects.hasMoreElements()) {
Object3D obj = (Object3D) objects.nextElement();
if (obj.getVisibility()) {
GLSLShader objShader = shaders.get(i);
obj.setShader(objShader);
i++;
}
}
shaders.clear();
}


Or do I have to do anything else too? This snippet is called when I want to assign depthshader to the object3ds.
#6
I think this package contains those shaders (attachment)
#7
These are same which are used in thomas' game .
Vertex shader shadow map

uniform mat4 modelViewProjectionMatrix;

attribute vec4 position;

varying vec4 vPosition;

void main(){
vPosition = modelViewProjectionMatrix * position;
gl_Position = vPosition;
}



fragment shader shadowmap

#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif

uniform float nearPlane;
uniform float farPlane;
uniform float bias;

varying vec4 vPosition;

vec4 packFloat(float value){
#ifdef GL_FRAGMENT_PRECISION_HIGH
const vec4 PACK_FACTORS = vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0);
const vec4 BIT_MASK = vec4(0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);
vec4 packetValue = fract(PACK_FACTORS * value);
return packetValue - packetValue * BIT_MASK;
#else
const vec3 PACK_FACTORS = vec3(128.0, 128.0 * 256.0, 128.0 * 256.0 * 256.0);
vec3 packetValue = floor(PACK_FACTORS * value);
packetValue -= vec3(0.0, packetValue.r * 256.0, packetValue.g * 256.0);
return vec4(packetValue / 255.0, 1.0);
#endif
}

void main() {
gl_FragColor = packFloat((vPosition.z - nearPlane) / (farPlane - nearPlane) + bias);
}


#8
No , It only renders a black strip over white fb when I only use projector camera and without depthshader. I am doing this...

public void update(World world, FrameBuffer fb) {
if (light != null) {
if (!setted) {
Enumeration<Object3D> objects = world.getObjects();
while (objects.hasMoreElements()) {
Object3D object = objects.nextElement();
if (!object.getName().startsWith("particle")) {
PolygonManager pm = object.getPolygonManager();
int maxID = pm.getMaxPolygonID();
for (int i = 0; i < maxID; i++)
pm.addTexture(i, textureID, TextureInfo.MODE_MODULATE);
}
}
projectionMatrix = projector.getProjectionMatrix(fb, nearPlane, farPlane);
setted = true;
}
updateProjector();
Camera originalCam = world.getCamera();
Logger.log("blbllbbalablllllllllllllllllllllll");
world.setCameraTo(projector);
fb.clear(RGBColor.WHITE);
world.renderScene(fb);
world.draw(fb);
fb.display();
}
}

#9
Yes . Everything Works fine when rendering normally.
#10
    The  visibility lists is no more there when I put fb.display() on Ondrawframe().
But I still see a blank screen ....and a white blit overlay. When I put logger.log something in my update   
method and in tools.renderwithshader() method...it does show up in my log o/p. Which ,I think suggests that my code does reach till there.
Don't  know whats happening. :(
#11
If I comment out
"fb.setRenderTarget(shadowTexture, 1, 1, 1, 1, true);"
and"   fb.removeRenderTarget();"
then I stop getting the log o/p additionallist
and the result is a white framebuffer (due to fb.clear(white).)with black blit shadowtexture.
exact oppsite of first result!..
I Could not find any relation.
Also I wanna know ...That is my code from the first post is O.K for shadows ? Is it complete?
I am actually simply copying/hacking /retrofitting Thomas' example for shadows to work . 
#12
   I am using Thomas' Game sample and his JPCT extentions (Both are Great Help ! Thanks for open sourcing them !!! ) for creating a world with a cuboid and a plane surface which is having a spotlight.
I really know nothing about shaders, but at the same time trying/eager to have some basic shadowsmapping in my work . 
What I did -
1. On My Oncreate Method I loaded custom shaders .

ZipInputStream zis = new ZipInputStream(res.openRawResource(R.raw.data));
ZipEntry ze;
try {
while ((ze = zis.getNextEntry()) != null) {
BLABLA....

ShaderProvider.setShader(ze.getName(), sb.toString());
}

zis.closeEntry();
zis.close();
          BLABLAh....

2. On my OnSrfacechanged...

shadowHelper = new cz.chladek.jpct.extension.ShadowProjector();
world.getLightController().setShadowHelper(shadowHelper);


3.Ondrawfrme::..

shadowHelper.update(world, fb);



4.  Removed
              world.renderScene(fb);
world.draw(fb);

fb.display();

This from my ondrawframe.


Also THis is what in the update method..............

public void update(World world, FrameBuffer fb) {
if (light != null) {
if (!setted) {
Enumeration<Object3D> objects = world.getObjects();
while (objects.hasMoreElements()) {
Object3D object = objects.nextElement();
if (!object.getName().startsWith("particle")) {
PolygonManager pm = object.getPolygonManager();
int maxID = pm.getMaxPolygonID();
for (int i = 0; i < maxID; i++)
pm.addTexture(i, textureID, TextureInfo.MODE_MODULATE);
}
}
projectionMatrix = projector.getProjectionMatrix(fb, nearPlane, farPlane);
setted = true;
}
updateProjector();
Camera originalCam = world.getCamera();

world.setCameraTo(projector);
fb.setRenderTarget(shadowTexture, 1, 1, 1, 1, true);
fb.clear(RGBColor.WHITE);
Tools.renderWithShader(world, fb, depthShader);
fb.display();
fb.removeRenderTarget();
world.setCameraTo(originalCam);
}
}


And Tools.renderwithshader......................

public static void renderWithShader(World world, FrameBuffer fb, GLSLShader shader) {
Enumeration<Object3D> objects = world.getObjects();
while (objects.hasMoreElements()) {
Object3D obj = (Object3D) objects.nextElement();
if (obj.getVisibility()) {
GLSLShader objShader = obj.getShader();
shaders.add(objShader);
obj.setShader(shader);
}
}

world.renderScene(fb);
world.draw(fb);

objects = world.getObjects();
int i = 0;
while (objects.hasMoreElements()) {
Object3D obj = (Object3D) objects.nextElement();
if (obj.getVisibility()) {
GLSLShader objShader = shaders.get(i);
obj.setShader(objShader);
i++;
}
}
shaders.clear();
}



**********************************************************************
  ___ Result was a blank black screen .___...I also used this

shadowHelper.blitShadowMap(fb, halfW - 64, fb.getHeight() - size - 10, size);

to blit the shadowTexture ... but it is also blank white blit .

Then I did many funny experiments with different laughable  results but none produced the desired results.

also my log o/p is full of this-
02-27 10:59:17.330: I/jPCT-AE(7147): Additional visibility list (106) created with size: 512
02-27 10:59:17.350: I/jPCT-AE(7147): Additional visibility list (107) created with size: 512
..........
#13
Support / Re: set texture at runtime
November 21, 2014, 06:22:57 AM
 It is simple.....Just for the start , the most simple and basic would be like this-
1.Make sure u have all the texture to be switched in the memory .That means , load all your textures when initially creating the world .
2.Apply your first texture on the object while creating world/scene .
3. For switching texture -->
Have your touch/button clicking condition checked (Like in helloworld sample see the  touchturn("if "condition) or something like that in the ondrawframe ).
Inside that ,set the second texture on the desired object in the ondrawframe . But yes ..you have to make sure that you do that only once or  it would throw an  error .
You can do that by having a boolean global variable  set to false ( secondtexapplied=false)..And then inside your  button/touch logic  in  ondrawframe ....
if(secondtexapplied==false)
{
change/apply second tex on object
secondtexapplied==true;
}
#14
Projects / Re: Thinking about some RPG..Android version.
November 20, 2014, 05:43:01 PM
  Just curious :)!  Are you planning to have multiple character classes ?
One more thing .....   The fence and door appears to be kinda floaty ! 
#15
Projects / Re: Craft The Path
October 14, 2014, 03:53:33 PM
   Nice puzzle concept ! Seeing so much of your projects/ works inspired by minecraft's blocky graphics , you are probably a great minecraft  fan, I think  ;D :D!!
The look and feel  of the game is enhanced due to  ambient occlusion ! You mentioned about fake AO.
May you please tell me something about it ? And also can it be extended to complex models, geometries instead of simple blocks?