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.


Messages - lawless_c

Pages: 1 ... 3 4 [5] 6 7
61
Support / Object3d switching/swapping in renderhook.
« on: November 21, 2014, 06:32:03 pm »
Is there a standard way for quickly swapping out objects?

I'm thinking of making an addition to my game so that objects get swapped for very simple billboards at large distances.

If i can i get two benefits:

incredible distant objects can be made easily selectable.

Rendering very large quantities of objects will have less of an impact of rendering speed(I'm not really worried by this though as it hasn't been an issue so far).

62
Support / Re: Which comes first: setvertexcontroller or build?
« on: November 10, 2014, 03:02:28 pm »
vertices are the lines not the faces
Neither...they are the end points of the lines.

oh right, sorry.

63
Support / Re: Which comes first: setvertexcontroller or build?
« on: November 10, 2014, 11:55:13 am »

64
Support / Re: How to perform attachments effect by jpct-ae?
« on: November 07, 2014, 06:40:18 pm »
The sphere could a shader done around a spherical object http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter16.html

edit: i dont think it would need to be as complex as the one in the link though as you aren't trying to simulate light scattering.
if you can use the shaders you may be able to set it so fragments at right angles to the camera are less transparent than those facing it.

65
Support / signed distance field fonts
« on: October 09, 2014, 01:38:25 am »
Thought this might be of interest to you guys , ive been working on a simple package for doing signed distance field fonts on Android.

https://github.com/lawlessc/distance-field-glyphs

It's shader based on what Paul Houx did here with Lib Cinder https://forum.libcinder.org/topic/signed-distance-field-font-rendering to implement valves paper.

And i have also written it so it uses SDFFonts in the his generator outputs them.
https://forum.libcinder.org/topic/signed-distance-field-font-rendering

It's incomplete at the moment but i hope to add more to it as i go along, and if other people want to make additions to it or fork it into something better thats even better. I think it may be useful for display some small amounts of text on screen(ideally without distortion at many resolutions) , at the moment the text can look a bit rough.

66
Support / Shaders, possible optimization?
« on: September 08, 2014, 03:28:42 pm »
This is just thought i haven't had a chance to try yet.

But i have multiple floats being sent to a shader, at the moment i do them one at a time.
Would it make more sense to simply add all these floats to an array and send them in one setUniform command?

So instead of using

setUniform(String name, float val) ;
setUniform(String name, float val) ;
setUniform(String name, float val) ;
setUniform(String name, float val) ;


I would use setUniform(String name, float[] val) ;

67
Support / Re: Shifting an objects position in shaders
« on: August 28, 2014, 10:56:23 am »
 :) Thanks, i'll try casting them when i get the chance.




I wanted to because i figured if i get this right https://www.youtube.com/watch?v=CGZRHJvJYIg  it will give me much more control. I would only have to use one texture containing the characters, I would be able to use this at various sizes.and things like borders and glow effect on text could be done in the shaders too.

I've already created a factory too that parses the data and creates the strings, my intention was to make it as it's own package and leave on it github for people here to use, improve , fork etc.

68
Support / Re: Shifting an objects position in shaders
« on: August 28, 2014, 02:39:14 am »
I'm taking in the offsets and advance floats that are usually numbers like 48.0 , 52.1 etc
I think i may need to modify to work with "clip space" which seems to be -1.0 to 1.0 (not sure how though)

If you're wondering what it's for im attempting to implement signed distance field fonts. I actually managed to get it working with multiple overlays, one per each character but im trying to do it with a single one now. The repeat rendering sort of works in that it will draw each character in a string, however they all end up in single spot.

The uniforms bottomleftx and bottomlefty are finding where in the texture a character is before it's rendered(this works) though some characters end up being skewed
as the overlay dimensions don't match the character.

Code: [Select]
   @Override
   public boolean repeatRendering() {
      renderingIndex++;
     
      if(renderingIndex < charactersList.length && renderingIndex > 0)
      {
         
      advances = advances + charactersList[renderingIndex].advanceX;
   
     
      Overlayshader_.setUniform("a_colour",new SimpleVector(1,(renderingIndex*0.1f),0));
      Overlayshader_.setUniform("bottomLeftx",charactersList[renderingIndex].bottomLeftx);
      Overlayshader_.setUniform("bottomLefty", charactersList[renderingIndex].bottomLefty);   
      Overlayshader_.setUniform("width",charactersList[renderingIndex].width);
      Overlayshader_.setUniform("height",charactersList[renderingIndex].height);
     
      Overlayshader_.setUniform("offestx",renderingIndex);
      Overlayshader_.setUniform("offesty",0);
     
     
      return true;
      }
     
     
     
      setUpOverlayStart();
      renderingIndex=0;
      advances=0;
      return false;
   }


This is an example show three different strings i've added, the bottom one demonstrates a single character string a skewed zero.





And my vertex shader code


Code: [Select]

precision highp float;
// VERTEX SHADER


uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;

uniform float bottomLeftx;
uniform float bottomLefty;

uniform float width;
uniform float height;
uniform vec3 a_colour;

uniform float offsetx;
uniform float offsety;

attribute vec2 texture0;
attribute vec4 position;



varying vec4 v_color;
varying vec2 v_texCoord;

void main()
{
v_color = vec4(a_colour.x,a_colour.y,a_colour.z,1.0);

v_texCoord.x = bottomLeftx + (texture0.x/width);
v_texCoord.y = bottomLefty + (texture0.y/height);


vec4 newpos = vec4(offsetx,offsety,0,0);

gl_Position = projectionMatrix*((modelViewMatrix  * position) +newpos);

}

69
Support / Re: Shifting an objects position in shaders
« on: August 27, 2014, 01:55:42 am »
Actually is it possible to update gl_position in repeatRendering()for a renderhook?? or even an Overlays coordinates? I cant seem to change these past when they are first set.

70
Support / Re: Shifting an objects position in shaders
« on: August 22, 2014, 02:32:23 pm »
I'll give that a shot, would gl_FragCoord work too? maybe if i altered that instead of naively thinking i could alter gl_position.

71
Support / Shifting an objects position in shaders
« on: August 22, 2014, 01:08:14 pm »
Is it possible to shift the position of pixels being drawn in JPCT? im trying to render something and im using IRenderHooks repeatRendering method with an overlay and i want to shift it to the right on each rendering.

I've tried changing the overlay position itself in the repeatRendering method , that doesn't work however because of the way rendering all those objects remain in the same place.

The only way i can think is perhaps with pixel shaders, which i dont believe JPCT supports.


edit:  I may be misunderstanding how the shaders work but so far attempts to sue gl_position to shift the position of where i want a pixel to appear have failed.

72
What is it doing?

73
Support / Re: Can shaders be applied to textures?
« on: June 19, 2014, 02:30:58 am »
I'll give that shot , if I find something that works I'll report back what I got working here.

75
Support / Can shaders be applied to textures?
« on: June 16, 2014, 11:24:28 pm »
I wanted to know this as id like to know if i't possible to apply shaders to textures such as for a UI, or something that will get placed on the framebuffer. The only way i can currently think of doing this might be to apply it to a flat mesh and have against the camera.

Pages: 1 ... 3 4 [5] 6 7