Jump to content

Gilmer

Members
  • Posts

    293
  • Joined

  • Last visited

Everything posted by Gilmer

  1. Hello, I'm using CameraPick, everything is working OK, but I noticed that the first Pick it takes longer, even causes a stop in fps, which can be? // Game loop while( !KeyHit() && !AppTerminate() ) { if( !AppSuspended() ) // We are not in focus! { // Faz um pick e pega a entidade e altera de cor if (MouseHit(1)) { if ( CameraPick(&pick,camera,Vec3(MouseX(),MouseY(),100))) { EntityColor(pick.entity,Vec4(1,0,0,0)); } } // Update timing and world UpdateAppTime(); UpdateWorld(AppSpeed()) ; // Render UpdateFramework(); RenderFramework(); //DrawText(10,10,"FPS: %f",FPS()); Flip(0); } }
  2. First thank you! Already checked the shader.pak, it's all right
  3. hehe, i post in a minute after you but thanks all
  4. To use the SSAO, is need put some command? Im using the SetSSao(1), and when debuggin, are crashing. I update to 2.4.. My code is this: #include "engine.h" #include "math.h" int main( int argn, char* argv[] ) { Initialize() ; RegisterAbstractPath("D:\Projetos\safari\data"); SetAppTitle( "Safari" ) ; Graphics( 1280,768,32) ; AFilter(16) ; TFilter() ; TWorld world; TMesh mesh; TLight light; TMesh ground; TMaterial material; world = CreateWorld() ; if (!world) { MessageBoxA(0,"Error","Failed to create world.",0); return Terminate(); } TFramework framework=CreateFramework(); TLayer layer = GetFrameworkLayer(0); TCamera camera=GetLayerCamera(layer); //CAMERA PositionEntity(camera,Vec3(-24.54,2,-13.88)); RotateEntity(camera,Vec3(0,-60,0)); float zoom=1.0/tan(115/2.0); CameraZoom(camera,zoom); //Load Map LoadScene("abstract::safari.sbx"); //SkyBox SetSkybox(LoadMaterial("abstract::safarisky.mat")); SetBackgroundColor(Vec4(1,1,1,1)); light=CreateDirectionalLight(); RotateEntity(light,Vec3(21.23,159.54,3.61)); AmbientLight(Vec3(0.5,0.43,0.34)); EntityColor(light,Vec4(0,0,0,1.5)); SetDistanceFog(1); SetDistanceFogRange(0,200); SetDistanceFogColor(Vec4(0.99,0.93,0.81,1)); SetDistanceFogAngle(0,15); //fx SetGodRays(1); SetHDR(1); SetBloom(1); //THE ERROR IS HERE //SetSSAO(1); SetAntialias(1); SetVegetationShadowMode(1); TMesh zebra=LoadMesh("abstract::safari_animals_zebra.gmf"); PositionEntity(zebra,Vec3(-9.79,0.24,-12.98)); TMesh elefante=LoadMesh("abstract::safari_animals_elephant.gmf"); PositionEntity(elefante,Vec3(-22.91,0,-10.21)); // Game loop while( !KeyHit() && !AppTerminate() ) { if( !AppSuspended() ) // We are not in focus! { // Update timing and world UpdateAppTime(); UpdateWorld(AppSpeed()) ; // Render UpdateFramework(); RenderFramework(); // Send to screen Flip(0); } } // Done return Terminate() ; }
  5. With some searches, i found in the old forum, the following formule: fov = 115; zoom = 1.0/tan(fov/2.0); but, no documentation wiki, dont have nothing talking about this...and is this which is working. I use this with the CameraZoom.
  6. i think is not, or i doing wrong..hehehe for sample, in editor, i set the FOV to "115", but if i use the CameraZoom, what value which i need set? I put "CameraZoom(camera,115)", it show a zoom very long, but if i put "CameraZoom(camera,-115)", the image is inverted.
  7. Thanks Macklebee, The Fog is really what I was needing, but I think it would be to CameraRange the FOV, would not it?
  8. Hello, im with the following doubt, in editor, in main properties, i can set the camera fov. But when i make the program in c++, has none command that i can are setting the fov. I searched in wiki and in the forum, but i not found nothing. How i can make this? The same problem occurs with the fog, i dont found any commando for this..
  9. hmmm..thanks josh.. just one more question, how i can set the distance for the vegetation change to billboard? i think that change is very close to the camera..
  10. Hello, I wonder, how can I work with billboards? I saw the example of the billboard at Spruce Private folder. And I realized that it is a 1024x512 image containing all the sides of the model. But I wonder if you need to put some additional control, some shader? I think unfortunate way, that has many things in leadwerks that does not contain the documentation, and no article on the site about them. One example is the cubemap shader, which was added to shaders.pak and was not warned or anything...
  11. How i can use the colored shadows? I see that is new in 2.4, but if i checked the option to enable, in model properties, nothing change. I need enable another thing??
  12. Cool your idea macklebee, i think right now would be more appropriate. But how could the normal check that is being presented at the render?
  13. Tyler I tested the two examples, generating the black cube, not applying the texture []
  14. thanks TylerH.. :­) I tested here, and also was without displaying the texture. I tested putting the skybox texture in place of cubemap, and it showed. I think it is related in time to pass the cubemap to shader =/
  15. Thanks TylerH, but if i understand, the "BindTexture( TTexture texture, int texunit )" dont have parameter, to pass the cube faces. I can use it to pass the texture, but how i say what's the face? I found the SetColorBuffer(), and have a parameter to cubemap. I could use it?? thanks again for help, the leadwerks still some new for we..
  16. So, we create a script in lua, to render the six faces from cubemap, disabled the shadows, and turned down the quality. But the doubts, is why the shader, render only the skybox layer, if in no time i pass to it? And for sample, if i use this script to pass the images to shader, how i should pass, a image with resolution 1536x256, but that have six images inside, or six images 256x256, one for one? And how i can pass to the shader, the images from script? I Need pass the image to the "texture0" of shader.. Thanks all, for helping..
  17. Thanks for helping again JTimm So, for now I'll leave it like this shader. What I'm in doubt, is how to render the models around? The shader is passing the images from skybox texture, and not get the main layer, which it objects around, I believe that doing so would give a significant improvement in the result. How could I change to do that? Thanks again
  18. Thanks for answer JTimm... I did what you said, and i used the specular as a "mask" where it will reflect. But even so, i dont like of result, i want make some like this: But the result, is this: I searched some shader to car paint, or some explanation of how it works, but i dont found. And an another issues, how i can get the render of layer from objects around, instead of skybox? If i move the car, between a vegetation, is a little strange reflect only the sky, and not the tree arounds.. Thanks again for help
  19. anyone? I need it very much this. =/
  20. Hello Josh, thanks for feedback. I sync my sdk, and tested the new shader. But have a problem, the shader show the reflect, but does not show the diffuse together, the shader "mesh_diffuse_cubemap" dont show the reflect. So i took the "mesh_cubemap" and im changing to merge the diffuse with reflect. The problem is that the cubemap use the channel "texture0" in the shader, and the diffuse "texture1". If i keep it, i can merge, but dont show shadows in model, but, if i change the cubemap to "texture1" and the diffuse to "texture0", the diffuse show, but dont show the reflect.. What i need change in cubemap, to render using the "texture1"? This is what I changed: .... #ifdef LW_CUBEMAP uniform samplerCube LW_CUBEMAP; varying vec3 cubemapdir; varying vec3 cubemapnormal; vec4 cube; vec4 diftex; #endif ... void main(void) { ... #ifdef LW_CUBEMAP vec3 cubecoord = reflect( normalize( modelvertex.xyz - cameraposition ), normal * gl_NormalMatrix ); cube = vec4( textureCube(LW_CUBEMAP,cubecoord).xyz, diffuse.w); diftex = texture2D(LW_DIFFUSE,texcoord); diffuse = diftex+cube; #endif ... } ... thanks
  21. Hello, I am currently working on a shader, to show reflection by cubemap. I commented some lines, and left only to show the diffuse. But the problem is that, is dont generating shadows, is fullbrigh. And if i put the command: "gl_FragData[0] = diffuse;", the leadwerks crash.. Here is the shader: cube.frag #extension GL_ARB_draw_buffers : enable // Color of the material uniform vec4 matColor = vec4(0.3,0.3,0.32,1.0); // Cube map uniform samplerCube texture6; // Reflection factor uniform float reflectionFactor = 1.0; uniform float apptime; uniform vec2 buffersize; uniform float meshlayerrange; uniform float meshlayerheight; uniform vec3 cameraposition; uniform float camerazoom; uniform float vegetationviewdistance; uniform float vegetationheight; //include "abstract::greyscale.txt" //include "abstract::DepthToZPosition.frag" varying vec3 T,B,N; varying vec2 texcoord0; varying vec2 texcoord1; varying vec3 cubecoord; varying vec3 vertexposition; varying vec4 modelvertex; varying vec4 projectionspace; varying vec4 refractionspace; varying vec4 fragcolor; float fOcclusionShadow = 1.0; //DIFFUSE #define LW_DIFFUSE texture0 #ifdef LW_DIFFUSE uniform sampler2D LW_DIFFUSE; #endif #ifdef LW_DIFFUSE2 uniform sampler2D LW_DIFFUSE2; #endif //////// void main(void) { // -------- DIFFUSE vec4 diffuse = fragcolor; vec3 normal; float shininess = 0.0; vec2 texcoord=texcoord0;// only use this because of parallax mapping float selfillumination = 0.0; #ifdef LW_DIFFUSE2 vec4 diffuse2 = texture2D(LW_DIFFUSE2,texcoord0); diffuse = vec4(1); #endif #ifdef LW_DIFFUSE diffuse *= texture2D(LW_DIFFUSE,texcoord); #endif #ifdef LW_DIFFUSE2 diffuse = fragcolor.r * diffuse + (1.0-fragcolor.r) * diffuse2; #endif gl_FragData[0] = diffuse; // ---------------- // -------- NORMAL normal=normalize(normal); // ---------------- //gl_FragColor = mix(matColor, textureCube(texture6, cubecoord)+diffuse, reflectionFactor); //diffuse = diffuse + (textureCube(texture6, cubecoord)/2); gl_FragColor = diffuse; } cube.vert Include "MeshMatrix.vert" uniform float apptime; uniform vec2 buffersize; uniform float meshlayerrange; uniform float meshlayerheight; uniform vec3 cameraposition; uniform float camerazoom; uniform float vegetationviewdistance; uniform float vegetationheight; varying vec3 T,B,N; varying vec2 texcoord0; varying vec2 texcoord1; varying vec3 cubecoord; varying vec3 vertexposition; varying vec4 modelvertex; varying vec4 projectionspace; varying vec4 refractionspace; varying vec4 fragcolor; void main() { vec4 vertexcameraposition; Include "GetMatrix.vert" fragcolor = gl_Color*color; modelvertex = gl_Vertex; mat3 nmat = mat3(mat[0].xyz,mat[1].xyz,mat[2].xyz); modelvertex = mat * modelvertex; vertexposition = modelvertex.xyz; vertexcameraposition = gl_ModelViewProjectionMatrix * modelvertex; texcoord0=gl_MultiTexCoord0.xy; texcoord1=gl_MultiTexCoord1.xy; cubecoord = modelvertex.xyz - cameraposition; cubecoord = reflect( cubecoord , normalize(nmat * gl_Normal) ); nmat = gl_NormalMatrix * nmat; N = normalize( nmat * gl_Normal ); gl_Position = vertexcameraposition; #ifdef __GLSL_CG_DATA_TYPES gl_ClipVertex = gl_ModelViewMatrix * modelvertex; #endif }
  22. lumooja, you could can explain how to make this?? a long time i trying create a material of car, with reflects, specular and all...
  23. Hello all, im having a problem recently with the editor. I'm using version 2.32r4. When i open the my map, the map is extremely slow, the FPS is around 6. But if i switch to game, and return to edition mode, the FPS, rises and is normal, verging on 40. I suspect that is some related to physic, the scene have a lot animated models. But ive done some testing and not found the problem. I also tried too open, in the new version(2.32r5), but dont's worked. My graphics card, is a GFX 250S. Thanks This is a piece of my scene:
  24. I did the conventional method, i create a high model in zbrush, and after, baked the normal. Take a look if I need to do something to improve: thanks all for help
×
×
  • Create New...