Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (581)
Games in Android Showcase (162)
games submitted by our members
Games in WIP (632)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 ... 3 4 [5] 6 7 ... 10
 41 
 on: 2015-05-24 16:26:47 
Started by tommohawkaction - Last post by tommohawkaction
Okay been working on this all day now and i have got no where other then a plane (with colour) on the ground however for me to get this to work i had to create my own shader and make a transformation matrix using a method i made in LWJGL.. I thought libgdx had all the basic stuff done?

I am now struggling with textureing as the Texture class doesnt allow you to access its  ID but you can bind it but that doesnt work as i need to tell the shader which texture to draw using its ID... ahhhhhhhhh  Angry

 42 
 on: 2015-05-24 16:25:05 
Started by SauronWatchesYou - Last post by chrislo27
You could have a 1x1 texture generated at runtime (or even stored if you wanted) and draw black tiles (with different alpha) on top of each block. This would also allow you to "light" entities.

I know you did want a blockier look, but you could even use gradients to smooth it out:


I know that your game is top down, but if you're going for a "gravity-down" (I can't remember the term for it right now, but a game like Terraria) game, you will need to use a shader to mask the lighting onto the world terrain so the "shadows" you drew don't interfere with the background (this guy had that problem in this thread).

Performance wise, this isn't all that bad if you only render the blocks around you. In your image, you are rendering 20x13 (ish) blocks. I'm rendering a lot more and it still does quite decent even on old machines.

 43 
 on: 2015-05-24 16:22:26 
Started by steg90 - Last post by chrislo27
OpenSimplex noise is a type of simplex noise that doesn't have patents on it. Simplex noise was made by the same guy who made Perlin noise (Ken Perlin), only difference is that simplex noise becomes much faster in more dimensions compared to Perlin noise.

If I wanted less jagged-y hills, I could tone down the amplitude (instead of multiplying each block coordinate by 0.15, it could be 0.05). The reason the hills are so jagged in my picture is because the blocks in my game are much bigger compared to Terraria.

 44 
 on: 2015-05-24 15:14:40 
Started by Riven - Last post by Riven
I took JGO down for 3 minutes to check whether the down-alert emails/SMS/app-notifications were properly harassing me. Next time JGO goes down I'll know. Trust me, I'll know.

 45 
 on: 2015-05-24 14:57:51 
Started by tommohawkaction - Last post by tommohawkaction
Is there a way i get can hold of the default shader instead of having to create a new one for the meshes?

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  
      String vertexShader = "attribute vec4 a_position;    \n" + 
                "attribute vec4 a_color;\n" +
                "attribute vec2 a_texCoord0;\n" +
                "uniform mat4 u_worldView;\n" +
                "varying vec4 v_color;" +
                "varying vec2 v_texCoords;" +
                "void main()                  \n" +
                "{                            \n" +
                "   v_color = vec4(1,0,0,1); \n" +
                "   v_texCoords = a_texCoord0; \n" +
                "   gl_Position =  u_worldView * a_position;  \n"      +
                "}                            \n" ;
String fragmentShader = "#ifdef GL_ES\n" +
                  "precision mediump float;\n" +
                  "#endif\n" +
                  "varying vec4 v_color;\n" +
                  "varying vec2 v_texCoords;\n" +
                  "uniform sampler2D u_texture;\n" +
                  "void main()                                  \n" +
                  "{                                            \n" +
                  "  gl_FragColor = v_color;\n" +
                  "}";
     
      shader = new ShaderProgram(vertexShader, fragmentShader);
     
      modelBatch

 46 
 on: 2015-05-24 14:48:03 
Started by tommohawkaction - Last post by tommohawkaction
No its quite simple as he doesnt rotate the camera so no billboarding is needed.
I am just stuck trying to get a plane to render with colour/texture ahh

 47 
 on: 2015-05-24 14:13:55 
Started by tommohawkaction - Last post by CaptainJester
I don't do much 3D myself, I just know the concepts.

That image looks like he is using billboarding. Search on that term to see if it gives you what you want.

 48 
 on: 2015-05-24 13:53:40 
Started by SauronWatchesYou - Last post by Husk
If you're doing modern OpenGL, which you probably should be, shaders it is. You don't have to do it by blending, you could calculate the final pixel colour in the shader. I'm not sure which way would perform better, you'll have to benchmark that. Depending on how your game works, you might even be able to do the calculation in the vertex shader and let the GPU interpolate, though I'm not sure since I've never done it, but I like to think about it. Tongue

It'd simply be a matter of uploading a texture like this to the GPU:



Then either, use the shader to blend the tile and lightmap together, and output the final colour, or render the lightmap (using a simple passthrough shader) after you've rendered the tiles as their default colour and enable blending (you'll have to find the right blending function). Each tile only needs to correspond to one pixel in the lightmap.

All approaches should be sufficiently fast even on low spec computers, it's up to you on how you want to balance performance/development complexity. My guess is passing alpha values once to the GPU and using those will be fastest, but there is a reason we do benchmarks and testing. Tongue

 49 
 on: 2015-05-24 13:28:24 
Started by tommohawkaction - Last post by tommohawkaction
sorry again my mistake I meant face.
If you look at that photo above i am trying to do that same thing how would i do such a thing?
Example code would be helpful
If you willing to help via skype then my skype it: tommohawkaction


 50 
 on: 2015-05-24 13:28:19 
Started by kevglass - Last post by Eobard Aviles
Don't have a day job, currently, but I start work on Tuesday.  Shocked

My dream job is making my own online gaming company. Smiley

Pages: 1 ... 3 4 [5] 6 7 ... 10
 
MrMapcom (15 views)
2015-05-23 20:26:16

MrMapcom (20 views)
2015-05-23 20:23:34

Waterwolf (29 views)
2015-05-20 15:01:45

chrislo27 (35 views)
2015-05-20 03:42:21

BurntPizza (70 views)
2015-05-10 15:53:18

FrozenShade (56 views)
2015-05-07 09:11:21

TheLopais (218 views)
2015-05-06 13:36:48

TheLopais (202 views)
2015-05-06 13:35:14

TheLopais (207 views)
2015-05-06 13:33:39

TheLopais (226 views)
2015-05-06 13:32:48
List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00
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!