Jump to content

njord

Members
  • Posts

    57
  • Joined

  • Last visited

Everything posted by njord

  1. I have performed some tests on my pc with i7 920@2.67GHz cpu and 3way SLI Gtx285. It seems like LE does not utilize multiple SLI connected GPUs at all. In fact, fps drops by 3x when SLI is used. Anyway, my primary goal is not to enhance fps of a single app by using SLI. What I want to do is to split LE applications on different gpus, so that I can run multiple LE apps on single pc with nice fps. Thus, i tried disabling SLI, and creating LE editor windows, dragging them to each gpu's monitor. However fps dropped dramatically when the second and the third LE editors were opened, which means LE insists on using the first gpu on the system rather than also using secondary ones. What are your comments lads ? Any ideas to utilize all 3 gpus ? Test screenshots are in the attachment. ANT is our own terrain model. OCE is a basic LE terrain created with the editor.
  2. Very sorry for the late reply. I have a working traffic light model, its script and its shader working. If you want, I can send it to you or upload it somewhere. To clarify my problem : I use color to pass parameters to different instances of a mesh. Specifically, I use the color parameter to switch between texture reads to make some parts of the model glow (emissive) in the dark. My problem is, the lights attached to the mesh, and transparent surfaces of the mesh also get painted when i use color as a parameter. How can I setcolor of a mesh, but not set the color of a light attached to it ?
  3. Hi everyone. We have a simulator and 3 full hd monitors attached to it. Currently, we use 3 different computers, each running a leadwerks application and visualising the same scene on its independant monitor. The leadwerks applications on distinct pcs are synchronized through network. Of course, each LE app camera is given a certain heading degree, so that the final output image is panaromic when we look at all the monitors together. However, we would like to use a single computer, and generate the same panaromic image without any performance drop. We have a test computer with 3 gpus installed using 3way SLI. One way to do it I guess is to create a 5760 x 1080 pixels LE window and let it span over multiple monitors. However this way LE uses only one gpu right ? Does it at least benefit from SLI ? What is the proper/possible way of doing this in LE ? Can we launch different apps/render windows/viewports that run on each gpu and combine them ? Thanks in advance.
  4. Hello comrades. As you know, there is a traffic light model called "Switch" in Editor files. I can load it in C++ and use setkey functions to make it glow red or green. I extended its functionality to use it in car lights, brakelights, signals etc (thanks to Flexman's answer before forum breakdown). However, since (correct me if I'm wrong) only entity color is unique across hardware instances of a mesh, color is used as the parameter to set a switch's glowing state. so in switch's lua script there is this chunk of code : if self.active==1 then self.model:SetColor(Vec4(1,0,0,0),1) else self.model:SetColor(Vec4(0,0,0,0),1) end and in switch.frag shader : gl_FragData[3] = texture2D(texture2,texcoord)*fragcolor.x + texture2D(texture3,texcoord)*(1.0-fragcolor.x); which uses x (Red) component of the entity color as a ratio variable to either make texture2 or texture3 highlighted areas of the model "glowing". Lets say switch is a truck. "Red light" state turns its headlights glowing on, where "Green light" state turns its rearlights glowing on. Also I have a white spotlight entity attached to it. However each time I change the truck's color,I get the spot light painted in its parent's color. I tried to disable recursion when setting color by changing self.model:SetColor(Vec4(1,0,0,0),1) to self.model:SetColor(Vec4(1,0,0,0),0) but this did not help. Actually both headlights and rearlights on the truck start glowing without regards to color parameter when "self.model:SetColor(Vec4(1,0,0,0),0)" is used. Summing it up : I still want to control which texture to glow on my model, but I dont want my attached light entities get affected by their parent color. Thanks in advance! PS : I had this same getting painted problem with transparent surfaces on my vehicle too (not only child light entities). Here is my vehicle lights frag shader and vehicle lua script. I tried sending the state parameters only via alpha channel where color is always set to 1 1 1. That way at least my lights stay white all the time. frag shader : #define LW_DIFFUSE texture0 #define LW_BUMPMAP texture1 #define LW_BLOOM texture2 uniform sampler2D texture3; uniform sampler2D texture4; uniform sampler2D texture5; #extension GL_ARB_draw_buffers : enable uniform vec3 cameraposition; uniform vec2 buffersize; uniform vec2 camerarange; include "abstract::greyscale.txt" include "abstract::DepthToZPosition.frag" #ifdef LW_DETAIL uniform sampler2D LW_DETAIL; #endif #ifdef LW_DIFFUSE uniform sampler2D LW_DIFFUSE; #endif #ifdef LW_SPECULARMAP uniform sampler2D LW_SPECULARMAP; #endif #ifdef LW_BUMPMAP uniform sampler2D LW_BUMPMAP; #endif #ifdef LW_BLOOM uniform sampler2D LW_BLOOM; #endif #ifdef LW_CUBEMAP uniform samplerCube LW_CUBEMAP; #endif #ifdef LW_PARALLAXMAP uniform sampler2D LW_PARALLAXMAP; varying vec3 eyevec; #endif #ifdef LE_REFRACTION uniform sampler2D LE_REFRACTION; uniform sampler2D LE_DEPTHBUFFER; uniform float refractionstrength = 0.01; #endif #ifdef LW_POMMAP vec3 vLightTS=vec3(0.577,0.577,0.577); varying vec3 eyevec; float depthP = .15; float nMinSamples = 20; float nMaxSamples = 50; #endif #ifdef LW_ALPHABLEND uniform sampler2D LW_ALPHABLEND_INCOMINGCOLOR; uniform sampler2D LW_ALPHABLEND_INCOMINGNORMAL; #endif varying vec3 vertexposition; varying vec3 T,B,N; varying vec2 texcoord0; varying vec2 texcoord1; varying vec3 cubecoord; varying vec4 modelvertex; varying vec4 fragcolor; float fOcclusionShadow = 1.0; uniform sampler2D texture14; uniform float terrainsize; uniform vec3 terrainscale; uniform float bumpscale; uniform float specular; uniform float gloss; //Terrain color map uniform sampler2D texture12; void main(void) { vec4 diffuse = vec4(1);//fragcolor; vec3 normal; float shininess = 0.0; vec2 texcoord=texcoord0;// only use this because of parallax mapping vec2 terraincoord; float terrainresolution; #ifdef LW_PARALLAXMAP texcoord += (texture2D(LW_PARALLAXMAP,texcoord).x * 0.04 - 0.036) * normalize(eyevec).xy; #endif #ifdef LW_POMMAP // for POM, the heightmap is in the alpha of the diffuse so save ur diffuse with DXT5 I chose this because the alpha of DXT5 is higher precision //Include "POM.frag" #endif #ifdef LW_DIFFUSE diffuse *= texture2D(LW_DIFFUSE,texcoord)*fOcclusionShadow; #endif #ifdef LW_ALPHATEST if (diffuse.w<0.5) { discard; } #endif normal = N; #ifdef LW_BUMPMAP #ifdef LW_TERRAINNORMALS //Use terrain normals terraincoord=vec2(vertexposition.x,-vertexposition.z) / terrainsize + 0.5; terrainresolution = terrainsize / terrainscale.x; terraincoord += 0.5 / terrainresolution; vec3 worldNormal = ((texture2D(texture14,terraincoord).xyz - 0.5) * 2.0).xyz; normal = normalize(gl_NormalMatrix*worldNormal); #else vec4 bumpcolor = texture2D(LW_BUMPMAP,texcoord); normal = bumpcolor.xyz * 2.0 - 1.0; #endif #ifdef LW_DETAIL normal += texture2D(LW_DETAIL,texcoord * 4.0).xyz * 2.0 - 1.0; #endif normal.z /= bumpscale; normal = T * normal.x + B * normal.y + N * normal.z; normal = normalize(normal); #ifdef LW_SPECULAR shininess = bumpcolor.a*fOcclusionShadow*specular; #endif #ifdef LW_SPECULARMAP shininess = texture2D(LW_SPECULARMAP,texcoord).x*fOcclusionShadow*specular; #endif #endif #ifdef LW_TERRAINNORMALS #ifndef LW_BUMPMAP //Use terrain normals terraincoord=vec2(vertexposition.x,-vertexposition.z) / terrainsize + 0.5; terrainresolution = terrainsize / terrainscale.x; terraincoord += 0.5 / terrainresolution; //vec4 normsample=((texture2D(texture14,terraincoord).xyz - 0.5) * 2.0).xyz; vec3 worldNormal = ((texture2D(texture14,terraincoord).xyz - 0.5) * 2.0).xyz; normal = normalize(gl_NormalMatrix*worldNormal); //shininess = normsample.w; #endif #endif #ifdef LW_TERRAINCOLOR //Use terrain color terraincoord=vec2(vertexposition.x,-vertexposition.z) / terrainsize + 0.5; terrainresolution = terrainsize / terrainscale.x; terraincoord += 0.5 / terrainresolution; vec4 terraincolor = texture2D(texture12,terraincoord); diffuse = vec4( greyscale(diffuse.xyz) * 2.0 * terraincolor.xyz,diffuse.w); shininess = terraincolor.w; #endif #ifdef LE_REFRACTION diffuse.a=0.25; vec4 refractionvector = vec4( gl_FragCoord.x/buffersize.x, gl_FragCoord.y/buffersize.y, gl_FragCoord.z, 1.0 ); vec4 refractionvector2 = refractionvector + refractionstrength * vec4(normal,0.0); if (gl_FragCoord.z<DepthToZPosition(texture2DProj(LE_DEPTHBUFFER,refractionvector2).x)) { refractionvector=refractionvector2; } vec4 transparency = texture2DProj(LE_REFRACTION,refractionvector); diffuse = transparency * diffuse; #endif vec3 adjustednormal = normal*0.5+0.5; float adjustedgloss = gloss; gl_FragData[0] = diffuse; gl_FragData[1] = vec4(adjustednormal,1.0); gl_FragData[2] = vec4(shininess,gloss,0.0,diffuse.w); float lights = floor((fragcolor.w+0.49f) / 8.0f); float brakes = floor((fragcolor.w+0.49f) / 4.0f) - lights*2.0f; float leftsignals = floor((fragcolor.w+0.49f) / 2.0f) - lights*4.0f - brakes*2.0f; float rightsignals = floor(fragcolor.w+0.49f) - lights*8.0f - brakes*4.0f - leftsignals*2.0f; gl_FragData[3] = texture2D(texture2,texcoord)*lights + texture2D(texture3,texcoord)*brakes + texture2D(texture4,texcoord)*leftsignals + texture2D(texture5,texcoord)*rightsignals; //gl_FragData[3] = texture2D(texture2,texcoord)*fragcolor.x + texture2D(texture3,texcoord)*fragcolor.y + texture2D(texture4,texcoord)*fragcolor.z + texture2D(texture5,texcoord)*fragcolor.w; gl_FragData[3].w = 0.0; } lua script: require("scripts/class") local class=CreateClass(...) function class:InitDialog(grid) self.super:InitDialog(grid) group=grid:AddGroup("Chevrolet_Blazer") group:AddProperty("lights", PROPERTY_FLOAT, "0|0.0,5","lights") group:AddProperty("brakelights", PROPERTY_FLOAT, "0|0.0,5","brakelights") group:AddProperty("leftsignals", PROPERTY_FLOAT, "0|0.0,5","leftsignals") group:AddProperty("rightsignals", PROPERTY_FLOAT, "0|0.0,5","rightsignals") group:Expand(1) end function class:CreateObject(model) local object=self.super:CreateObject(model) object.lights = 0 object.brakelights = 0 object.leftsignals = 0 object.rightsignals = 0 function object:UpdateLights() --self.model:SetColor( Vec4(self.lights, self.brakelights, self.leftsignals, self.rightsignals), 1 ) self.model:SetColor( Vec4(1, 1, 1, 8 * self.lights + 4 * self.brakelights + 2 * self.leftsignals + self.rightsignals), 1 ) end function object:SetKey(key,value) if key=='color' then --overrides color setting elseif key=='lights' then self.lights = tonumber(value) if self.lights < 1.0 and self.lights > 0.0 then self.lights = 1.0 end elseif key=='brakelights' then self.brakelights = tonumber(value) if self.brakelights < 1.0 and self.brakelights > 0.0 then self.brakelights = 1.0 end elseif key=='leftsignals' then self.leftsignals = tonumber(value) if self.leftsignals < 1.0 and self.leftsignals > 0.0 then self.leftsignals = 1.0 end elseif key=='rightsignals' then self.rightsignals = tonumber(value) if self.rightsignals < 1.0 and self.rightsignals > 0.0 then self.rightsignals = 1.0 end else return self.super:SetKey(key,value) end self:UpdateLights() return 1 end object:UpdateLights() end
  5. Hello guys. When creating a terrain in Editor, we can add trees and other vegetation either by "drag and drop" or "vegetation layer tool". Of course adding trees with "drag and drop" is so exhausting and sometimes impossible for large terrains. The thing is, we use leadwerks for visualisation, "nvidia physx" as the physics engine in our simulator. So we need to create collision boxes and place them on the correct positions in the physics world manually. We implemented a simple program to create a physx mesh file (.sbx file that includes a terrain -> .obj file) from terrain heightfield so we can drive vehicles on a Leadwerks terrain. But when trees placed with the veg tool, I cannot retrieve their positions and orientations, so i cannot create and place collision meshes around. The ori and pos information are stored in the .dat files as Josh said (before the forum breakdown). But how can I read or retrieve them ? They are binary! Thanks in advance. PS : If you have any completely other ideas on creating collision boxes for leadwerks terrain objects, please share.
×
×
  • Create New...