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

#1
Support / Re: Polygon limitations on screen
July 31, 2024, 01:39:33 AM
Thank you!! You're a lifesaver! I had set the far clipping plane very close and removed some of the objects to "kind of" solve this, but for my purposes is not ideal, I really needed to put more things in scene.

p.s.: Again! Can't forgive myself for not seeing that in the documentation.
#2
Support / Polygon limitations on screen
July 28, 2024, 11:56:40 PM
I have this terrain with some planes scattered on it. About 2000 planes. when the camera faces many of them, the terrain and my player model stop being rendered. I have to make the camera look at where they aren't in order to be able to see the terrain and the player model again. Any tips?
Also, the planes were cloned using the cloneObject() method. I don't really know what to do now.

few planes on camera:
https://imgur.com/k3PNGug

many planes on camera:
https://imgur.com/T18Kh3r

update:
It seems to be a limit of objects on screen; when I move the camera some planes disappear e others appear, for some reason my player model and the terrain are not a priority and are ignored when there are many planes on screen. I removed some of the copies and this no longer happens. But I still would like to place many of them around my map.
#3
Thank you, guys! I think that's it. I'll rewrite the shader and use only jpct-ae from now on.
#4
I was using JPCT, but just for quick tests. I intend to use jpct-ae in the end.
#5
I'm very sorry! The information was clear in the docs. I really don't know why I didn't understand it when I read it at first. TextureInfo objects can only receive 4 images. It just ignores the rest if you add more.  :'(
#6
Hello!
I'm trying to reproduce something I did using blender nodes. I have 5 textures, but one of them is a map. I use its RGBA channels as the factors to mix the textures with black and then, finally add them up.

This is my Fragment Shader:
varying vec2 texCoord;

uniform sampler2D textureUnit0;
uniform sampler2D textureUnit1;
uniform sampler2D textureUnit2;
uniform sampler2D textureUnit3;
uniform sampler2D textureUnit4;


const vec3 BLACK = vec3(0.0,0.0,0.0);
const vec3 YELLOW = vec3(0.5,0.5,0.0);

void main (){

vec2 newTexCoords = texCoord * 20.0;

vec4 map = texture2D(textureUnit0, texCoord);
vec4 asphalt = texture2D(textureUnit1, newTexCoords);
vec4 grass = texture2D(textureUnit2, newTexCoords);
vec4 ground = texture2D(textureUnit3, newTexCoords);
vec4 wall = texture2D(textureUnit4, newTexCoords);

vec3 a = mix(BLACK, asphalt.rgb, map.r);
vec3 b = mix(BLACK, grass.rgb, map.g);
vec3 c = mix(BLACK, ground.rgb, map.b);
vec3 d = mix(BLACK, wall.rgb, map.a);

        vec3 result = a+b+c+d;


gl_FragColor = vec4(result,1.0);
}

This is the result:
https://drive.google.com/file/d/1DHwsnlmv_Htm43qofuhufOIMA8vHlSWv/view?usp=drive_link

Just by changing the line:
vec3 result = a+b+c+d;
to
vec3 result = a+b+c+mix(BLACK, YELLOW, map.a);

I almost got what I want:
https://drive.google.com/file/d/1Bqms-MgMFlo6VSv2Ualm0A6MSS4Qdshn/view?usp=drive_link
But in this case I'm not really using my 4 textures, just 3 and a color created inside the shader.

The problem seems to be in textureUnit4 I think it's not being passed to the shader and thus, it results in a black color, which makes no difference in the final sum. How many textures can I add to a TextureInfo object? If the maximum is 4, then, that must be the reason why my fifth sampler2D uniform is ignored.

p.s. I even wrote this before initalizing my FrameBuffer
Config.maxTextureLayers = 10;
but no success, unfortunately.