Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (580)
games submitted by our members
Games in WIP (500)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Newbie & Debugging Questions / Re: Free icons on: 2013-02-16 16:38:38
You can try deviant art, there are even some animated ones (if it's a game I assume you would love them to move)
2  Game Development / Newbie & Debugging Questions / Re: [libgdx] Shaders, Light system. on: 2013-02-16 16:05:52
Let me show the code, hope you guys can pinpoint what am I doing wrong here. (please help!)

Box2dLight used.

The Application Listener:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
public void create() {   
   testStage = new BaseStage(800, 480, true);      
   FileHandle backgroundPicture = Gdx.files.internal("assets/sampleBG.png");
   texture = new Texture(backgroundPicture);
   Image img = new Image("bg", texture);
   img.x = 0;
   img.y = 0;      
   testStage.addActor(img);      
}
@Override
public void render() {      
    GLCommon gl = Gdx.gl;
    gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
   
    testStage.act(Gdx.graphics.getDeltaTime());
    testStage.draw();
}


The Base Stage:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
public class BaseStage extends Stage implements InputProcessor {
   
   RayHandler rayHandler;  
   World world;
   OrthographicCamera camera;
   
   public BaseStage(float width, float height, boolean stretch) {
      super(width, height, stretch);
      Gdx.input.setInputProcessor(this);
     
      camera = new OrthographicCamera(80, 48);
      world = new World(new Vector2(0, 0), true);
      rayHandler = new RayHandler(world);
      rayHandler.setCulling(true);
      rayHandler.setCombinedMatrix(camera.combined);      
      rayHandler.useDiffuseLight(true);
      rayHandler.setAmbientLight(0.2f, 0.2f, 0.2f,1.0f);
   }

   @Override
   public void draw () {
      super.draw();        
     
      rayHandler.updateAndRender();
   }
   
   @Override
   public void dispose() {
      rayHandler.dispose();
   }
   
   public Vector2 gdxCoordinateToBox2D(float x, float y) {
      float K = 10;
      return new Vector2(x/K-width/(2*K), height/(2*K)-y/K);
     
   }

   @Override
   public boolean touchUp(int x, int y, int pointer, int button) {
      Vector2 coordinate = gdxCoordinateToBox2D(x, y);
      Color clr3 = new Color(0.5f,0.8f,0.2f, 0.9f);
      Light pt = new PointLight(rayHandler, 5, clr3, 30, coordinate.x, coordinate.y);
      pt.setStaticLight(true);
     
      return false;
   }
}




The Problem:



So when lights overlap, instead of getting more greener, it kinda cancels itsef and get's to original picture.
I guess I am using it wrong, any help will be so much appreciated!
3  Game Development / Newbie & Debugging Questions / Re: [libgdx] Shaders, Light system. on: 2013-02-12 14:33:20
Yeah, but is it like a known bug of box2dlight or just me?
4  Game Development / Newbie & Debugging Questions / Re: [libgdx] Shaders, Light system. on: 2013-02-11 15:32:57
Hi, a quick question:

The diffuse mode seems a lot more eye appealing, but it has some awkward effect when lights overlap. (green+green = red)
Is that a normal behavior? Or did I do something wrong?
5  Game Development / Newbie & Debugging Questions / Re: [libgdx] Shaders, Light system. on: 2013-02-09 14:28:07
Thanks!

I'll show you some screenshots when integrated, the project we are working on is hopefully very beautiful, and I hope you will like to see how it will all look like with box2dlight integrated Smiley

Here is the website if curious.
http://underwaterapps.com/project_moon/

Thanks again!
6  Game Development / Newbie & Debugging Questions / Re: [libgdx] Shaders, Light system. on: 2013-02-09 13:48:54
Oh well, that's great to hear then! we just go ahead and try to use it then! Thanks a lot!

First i read through the code of box2light I was a bit worried that it uses a physics engine to do a calculations, and I thought it might be slow, but yeah if you say it's not then it's great news.

I hope it is possible to use it with Stage class right?
7  Game Development / Newbie & Debugging Questions / Re: [libgdx] Shaders, Light system. on: 2013-02-09 09:24:07
So, that means that even if I do not need "more dynamic" system, box2dlight is still better in performance then the fake dynamic overlaying to buffer approach?
8  Game Development / Newbie & Debugging Questions / Re: [libgdx] Shaders, Light system. on: 2013-02-08 21:30:03
Wow, thanks! I think I am more interested in the one where it is pseudo dynamic, I am afraid bo2xlight might be using too much resources, so I'll take a look at your example code, looks pretty good so far! This is nor a primarily Android game, it is PC, but with a possibility of future Android port.
I will look at the example code more detailed tomorrow, but just to clarify, is this the right method?
1) Draw entire screen to buffer
2) Overlay Light to buffer using shaders
3) Render buffer to actual screen
4) Render elements that are not affected to light on screen.

If so, is there a room for optimization like:
1) render only parts that are expected to be affected by light to buffer so buffer will take less memory? (Does this make sense?)
2) Any caching techniques maybe?

Thanks a lot again!
9  Game Development / Newbie & Debugging Questions / Re: [libgdx] AssetManager acting strange on: 2013-02-08 14:48:27
Does it happen in Android or PC/JavaApp ?

Because if it's on Android, it can happen due to some weird memory management, for example some textures didn't get disposed correctly at exit e.g. it's hard to tell.
10  Game Development / Newbie & Debugging Questions / Re: [libgdx] Shaders, Light system. on: 2013-02-08 14:35:31
I am not sure about the naming, I am looking for effect that looks like a round circle. (you can see it on a screenshot)
Basically it's a simple effect of a gradient fading circle that overlays the scene. It gives the near surroundings a color. It does not have direction or anything.

And most importantly it does not need any fancy things like stop on walls or whatever.

What I need, looks like this Smiley
11  Game Development / Newbie & Debugging Questions / Re: [libgdx] Shaders, Light system. on: 2013-02-08 14:21:46
I think I will use a better wording if I say I need to implement "Ambient light" or "Spot Light", not sure but this seems like the right terminology do describe it Smiley
12  Game Development / Newbie & Debugging Questions / Re: [libgdx] Shaders, Light system. on: 2013-02-08 13:15:51
Thanks a lot guys, I'll read through some links! Smiley

But it's worth mentioning that I do not need any complex type of lights like directional ones, just point light that ill illuminate it's surroundings in a round shape.
I can basically do this with a small fragment shader code for one texture, but if used on entire screen I guess a Frame Buffer Object needs to be used, and here I am not sure about architecture and best practices.
13  Game Development / Newbie & Debugging Questions / Re: [libgdx] Shaders, Light system. on: 2013-02-08 12:58:27
I am not sure I understand what do you mean by "Block"

Let me show you a picture with example.



And here is an awesome tutorial I read before:
https://github.com/mattdesl/lwjgl-basics/wiki/ShaderLesson6
14  Game Development / Newbie & Debugging Questions / [libgdx] Shaders, Light system. on: 2013-02-08 12:13:53
Hi, new here!

So me and my friend are working hard on our 2D game engine based on LibGDX,
and it can do a lot but there is no support for Lights, So we need to implement a good lighting system,

I am relatively new to shaders though, while I've read lot's of cool tutorials on how it's done, the question that is left for me is an architecture of that all.
There are tons of tutorials on how to cast a light on one particular texture, but we have an entire scene, build of many many textures.

So what is the best way to do that? Render all scene to FBO, then apply light to it? if so, is it optimal to render entire scene to FBO or maybe just parts that potentially will be light up? What are the common practices/mistakes? Basically I am not seeing entire picture of how is this usually done Smiley Anyone did this before? would really appreciate any help or advice, and I can provide a screenshot of a level for example to make it really clear what I need to be done.

Thank!
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (48 views)
2014-04-15 18:08:23

BurntPizza (44 views)
2014-04-15 03:46:01

UprightPath (60 views)
2014-04-14 17:39:50

UprightPath (42 views)
2014-04-14 17:35:47

Porlus (58 views)
2014-04-14 15:48:38

tom_mai78101 (82 views)
2014-04-10 04:04:31

BurntPizza (140 views)
2014-04-08 23:06:04

tom_mai78101 (240 views)
2014-04-05 13:34:39

trollwarrior1 (200 views)
2014-04-04 12:06:45

CJLetsGame (207 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!