Jump to content

flachdrache

Members
  • Posts

    397
  • Joined

  • Last visited

Everything posted by flachdrache

  1. File Name: edEntity_SkySphere.zip File Submitter: TLD File Submitted: 17 Dec 2009 File Category: Models Triangles: 3968 mesh & textures by JuergenTimm aka TLD Simple halfsphere skymodels for use in the LE 2.3 editor - should work well with godrays but no sun is drawn atm. Free for use with Leadwerks Engine. Click here to download this file
  2. I try to convert an hlsl Sky shader to glsl and cant figure out how to do a proper NdotL calculation. So, what else for tools are usable to write/debug glshaders ? Currently iam just using the material editor and 3DLabs glsl validator and leaning from lighthouse3d and clockworkcoders. If you want to take a look into the shader iam messing around with #extension GL_ARB_draw_buffers : enable uniform sampler2D texture0; uniform float apptime; uniform vec3 lightdir; uniform vec3 sunpos; varying vec2 texcoord0; varying vec3 vertexposition; varying vec3 N; void main(void) { vec3 sunvector = normalize(-vertexposition.xyz + lightdir); vec2 TexCoord = vec2(apptime/40000.0, texcoord0.y * 2.0); vec4 color = texture2D( texture0, TexCoord ); float glowfactor = 0.2; // 0.6 float dotproduct = max(dot(-N, sunvector), 0.0); float sunglow = pow(dotproduct, 2.0) * glowfactor; if (dotproduct > 0.0) // near to sun { float sun = pow(dotproduct, 128.0) * 0.6; // * 0.6 color.rgb += sun + sunglow; // * sunglow } else // reverse side { float intensity = 0.299 * color.r + 0.578 * color.g + 0.114 * color.b; color.rgb -= sunglow/2.0; color = mix(color, vec4(intensity, intensity, intensity, color.a), sunglow); } gl_FragData[0] = color; gl_FragData[1] = vec4(1.0,1.0,1.0,0.0); gl_FragData[2] = vec4(0.0); gl_FragData[3] = vec4(0.0); } material file is calling shader="abstract::mesh_diffuse.vert","abstract::SkySphere.frag" and the image mapped to a sphere model [edit] passing vars to shader //pass shader TShader scatterShader = GetMaterialShader(scatterMat); //from Renderer::DrawEffectGodRays TVec3 lightdir; lightdir = TFormNormal(Vec3(0,0,1), sun, fw.GetMain().GetCamera() ); TVec3 sunPos; sunPos = EntityPosition (sun); SetShaderFloat(scatterShader, "apptime", AppTime() ); SetShaderVec3 (scatterShader, "lightdir", lightdir ); SetShaderVec3 (scatterShader, "sunpos", sunPos ); It suppose to look like this FrameLuaSampleScatterSimple but the sun is moving with the cameraPos atm. any help on wrapping my head around LE`s glsl very welcome.
  3. I used the older version for some time and the results are needed some good amount of "cleaning up" afterwards. I like to build my trees from scratch tbh. because of the more control in vertex count. Still using tree[d] for extracting the textured plain X since these are a pain to do by hand. There are quit some tricky parts for normalmapped trees, so my workflow goes as : build the tree trunk in silo/zbrush and UV texture those. build the "leafcloud" OR "leafcross" with tree[d]. mix, scale, convert etc. with leafcloud i mean this : a leafcross looks like this : The leafcloud gets Uv textured onto a spiderweb or umbrella like mesh. With using leafclouds i can extend the model assets because they are not part of the trunk model (added independent within sandbox) and of thus i got the naked winter tree with a "summer" leafsets. for the trunk i extract the plain ubersmooth normalmap from subdivided mesh and "convert" the "barktexture" into a bumpmap -> mixing those with ORB (OpenRenderBump) since it holds the least amount of hassle. I also once deformed the highpoly trunk ( in zbrush ) with the bumpmap but it wasnt worth the more work imo. hth, JT
×
×
  • Create New...