Jump to content

shadmar

Members
  • Posts

    3,618
  • Joined

  • Last visited

Everything posted by shadmar

  1. An earth like planet far away :
  2. Failed to publish file dialog box. This in the latest beta, I can't submit any image to the gallery. Log says: Error: m_SubmitItemUpdateResult = 9
  3. I load this as a postprocess, where the fullquad shader is the noise generated using equirectangular uv coordinates. The fullscreen uv coordinates fed this function for equirectangular distortion, then these coordinates are used for 3d-noise. vec3 GetSphereCoords(vec2 uv){ float theta = twopi * (uv.x); float phi = pi * (uv.y); float x3d = cos(theta) * sin(phi); float y3d = sin(theta) * sin(phi); float z3d = -cos(phi); return vec3(2*x3d,2*z3d,2*y3d); } The diff shader is just any diffuse+normal shader with textures fed from the buffers. Here is the buffer pipeline setup I used (lua file is loaded as postprocess): -------------------------------------------- -- Planet texture shader by Shadmar -------------------------------------------- --Called once at start function Script:Start() self.fullquadshader = Shader:Load("Materials/Star/_copland_project.shader") self.diff_shader = Shader:Load("Materials/Star/diffuse+normal+planet.shader") self.shader_pass = Shader:Load("Shaders/PostEffects/00_shaders/_passthrough.shader") self.onepass=true self.resolution=3 --this is x times screen resolution fullquadshader resolution will render self.passes=0 self.tex = nil end --Called each time the camera is rendered function Script:Render(camera,context,buffer,depth,diffuse,normals) --Create render buffers if they don't exist if self.buffer==nil then self.diffuse = Texture:Create(buffer:GetWidth()*self.resolution,buffer:GetHeight()*self.resolution,Texture.RGB, 0, 1, 0) self.diffuse:SetFilter(Texture.Smooth) self.diffuse:SetClampMode(true,true) self.normal = Texture:Create(buffer:GetWidth()*self.resolution,buffer:GetHeight()*self.resolution,Texture.RGB, 0, 1, 0) self.normal:SetFilter(Texture.Smooth) self.normal:SetClampMode(true,true) self.buffer={} self.buffer[0]=Buffer:Create(buffer:GetWidth()*self.resolution,buffer:GetHeight()*self.resolution) self.buffer[0]:SetColorTexture(self.diffuse) self.buffer[1]=Buffer:Create(buffer:GetWidth()*self.resolution,buffer:GetHeight()*self.resolution) self.buffer[1]:SetColorTexture(self.normal) end buffer:Disable() if (self.fullquadshader and self.buffer~=nil) then --generate fullscreen diffuse, render to a buffer if self.onepass==true and self.passes == 0 -- (first frame) dont hog gpu, do a second pass for normals. then self.buffer[0]:Enable() self.fullquadshader:Enable() self.fullquadshader:SetInt("doNormals",0) -- dont calc normals context:DrawImage(diffuse,0,0,buffer:GetWidth()*self.resolution,buffer:GetHeight()*self.resolution) self.buffer[0]:Disable() end --generate fullscreen normals, render to a buffer (second frame) if self.onepass==true and self.passes == 1 then self.buffer[1]:Enable() self.fullquadshader:Enable() self.fullquadshader:SetInt("doNormals",1) -- calc normals context:DrawImage(diffuse,0,0,buffer:GetWidth()*self.resolution,buffer:GetHeight()*self.resolution) self.buffer[1]:Disable() -- enable model shader and bind buffer textures self.diff_shader:Enable() self.diffuse:Bind(8) self.normal:Bind(9) --make sure this is just ran once. self.onepass=false end --enable context buffer and do a passthrough buffer:Enable() self.shader_pass:Enable() context:DrawRect(0,0,buffer:GetWidth(),buffer:GetHeight()) self.passes=self.passes+1 end end --Called when the effect is detached or the camera is deleted function Script:Detach() if self.fullquadshader then self.fullquadshader:Release() self.fullquadshader = nil self.diff_shader:Release() self.diff_shader = nil self.shader_pass:Release() self.shader_pass = nil end --Release buffers if self.buffer~=nil then self.buffer[0]:Release() self.buffer[1]:Release() self.buffer=nil end if self.diffuse~=nil then self.diffuse:Release() self.diffuse=nil self.normal:Release() self.normal=nil end self.onepass=true self.passes=0 end
  4. Planet, textures are postprocess generated. This runs 8 noise functions with 12 octaves, textures are rendered once to a buffer in postprocess and then used as reglar textures, runs at 60 fps no matter the noise complexity.
  5. This will carve roads using pivot childs and splines. Second terrain layer will be road color. http://www.leadwerks.com/werkspace/page/viewitem_?fileid=404532791 function smooth( points, steps ) if #points < 3 then return points end local steps = steps or 500 local spline = {} local count = #points - 1 local p0, p1, p2, p3, x, y, h for i = 1, count do if i == 1 then p0, p1, p2, p3 = points[i], points[i], points[i + 1], points[i + 2] elseif i == count then p0, p1, p2, p3 = points[#points - 2], points[#points - 1], points[#points], points[#points] else p0, p1, p2, p3 = points[i - 1], points[i], points[i + 1], points[i + 2] end for t = 0, 1, 1 / steps do x = 0.5 * ( ( 2 * p1.x ) + ( p2.x - p0.x ) * t + ( 2 * p0.x - 5 * p1.x + 4 * p2.x - p3.x ) * t * t + ( 3 * p1.x - p0.x - 3 * p2.x + p3.x ) * t * t * t ) y = 0.5 * ( ( 2 * p1.y ) + ( p2.y - p0.y ) * t + ( 2 * p0.y - 5 * p1.y + 4 * p2.y - p3.y ) * t * t + ( 3 * p1.y - p0.y - 3 * p2.y + p3.y ) * t * t * t ) h = 0.5 * ( ( 2 * p1.h ) + ( p2.h - p0.h ) * t + ( 2 * p0.h - 5 * p1.h + 4 * p2.h - p3.h ) * t * t + ( 3 * p1.h - p0.h - 3 * p2.h + p3.h ) * t * t * t ) --prevent duplicate entries if not(#spline > 0 and spline[#spline].x == x and spline[#spline].y == y) then table.insert( spline , { x = x , y = y, h = h } ) end end end return spline end function Script:Start() --get world and terrain local world=World:GetCurrent() for i=0,world:CountEntities()-1 do if world:GetEntity(i):GetClass()==Object.TerrainClass then self.terrain=world:GetEntity(i) tolua.cast(self.terrain,"Terrain") break end end --## Adust this t terrain size local terrainsize=256 while self.terrain == nil do System:Print("....") end local points = { } for d=self.entity:CountChildren()-1,0,-1 do local e = self.entity:GetChild(d) System:Print( "Pivot Childs:"..e:GetKeyValue("name") ) if self.entity:GetChild(d)~=nil then x=terrainsize/2+self.entity:GetChild(d):GetPosition(true).x y=terrainsize/2+self.entity:GetChild(d):GetPosition(true).z h=self.terrain:GetHeight(x,y) table.insert( points, { x=x, y=y, h=h } ) end --System:Print(x.." "..y.." "..h) end local spline = smooth( points ) local colorspline = smooth( points,100 ) for x=1,#colorspline-1,1 do self.terrain:SetLayerAlpha(0,colorspline[x].x, colorspline[x].y,1) self.terrain:SetLayerAlpha(0,colorspline[x].x+1, colorspline[x].y,1) self.terrain:SetLayerAlpha(0,colorspline[x].x-1, colorspline[x].y,1) self.terrain:SetLayerAlpha(0,colorspline[x].x+2, colorspline[x].y,1) self.terrain:SetLayerAlpha(0,colorspline[x].x-2, colorspline[x].y,1) self.terrain:SetLayerAlpha(0,colorspline[x].x, colorspline[x].y+1,1) self.terrain:SetLayerAlpha(0,colorspline[x].x+1, colorspline[x].y+1,1) self.terrain:SetLayerAlpha(0,colorspline[x].x-1, colorspline[x].y+1,1) self.terrain:SetLayerAlpha(0,colorspline[x].x+2, colorspline[x].y+1,1) self.terrain:SetLayerAlpha(0,colorspline[x].x-2, colorspline[x].y+1,1) self.terrain:SetLayerAlpha(0,colorspline[x].x, colorspline[x].y-1,1) self.terrain:SetLayerAlpha(0,colorspline[x].x+1, colorspline[x].y-1,1) self.terrain:SetLayerAlpha(0,colorspline[x].x-1, colorspline[x].y-1,1) self.terrain:SetLayerAlpha(0,colorspline[x].x+2, colorspline[x].y-1,1) self.terrain:SetLayerAlpha(0,colorspline[x].x-2, colorspline[x].y-1,1) self.terrain:SetLayerAlpha(0,colorspline[x].x, colorspline[x].y+2,.5) self.terrain:SetLayerAlpha(0,colorspline[x].x+1, colorspline[x].y+2,.5) self.terrain:SetLayerAlpha(0,colorspline[x].x-1, colorspline[x].y+2,.5) self.terrain:SetLayerAlpha(0,colorspline[x].x+2, colorspline[x].y+2,.5) self.terrain:SetLayerAlpha(0,colorspline[x].x-2, colorspline[x].y+2,.5) self.terrain:SetLayerAlpha(0,colorspline[x].x, colorspline[x].y-2,.5) self.terrain:SetLayerAlpha(0,colorspline[x].x+1, colorspline[x].y-2,.5) self.terrain:SetLayerAlpha(0,colorspline[x].x-1, colorspline[x].y-2,.5) self.terrain:SetLayerAlpha(0,colorspline[x].x+2, colorspline[x].y-2,.5) self.terrain:SetLayerAlpha(0,colorspline[x].x-2, colorspline[x].y-2,.5) end for x=1,#spline-1,1 do self.terrain:SetHeight(spline[x].x, spline[x].y, spline[x].h, false) self.terrain:SetHeight(spline[x].x, spline[x].y-1, spline[x].h, false) self.terrain:SetHeight(spline[x].x, spline[x].y+1, spline[x].h, false) self.terrain:SetHeight(spline[x].x, spline[x].y-2, spline[x].h, false) self.terrain:SetHeight(spline[x].x, spline[x].y+2, spline[x].h, false) self.terrain:SetHeight(spline[x].x, spline[x].y-3, spline[x].h, false) self.terrain:SetHeight(spline[x].x, spline[x].y+3, spline[x].h, false) self.terrain:SetHeight(spline[x].x, spline[x].y-4, spline[x].h, false) self.terrain:SetHeight(spline[x].x, spline[x].y+4, spline[x].h, false) self.terrain:SetHeight(spline[x].x+1, spline[x].y, spline[x].h, false) self.terrain:SetHeight(spline[x].x+1, spline[x].y-1, spline[x].h, false) self.terrain:SetHeight(spline[x].x+1, spline[x].y+1, spline[x].h, false) self.terrain:SetHeight(spline[x].x+1, spline[x].y-2, spline[x].h, false) self.terrain:SetHeight(spline[x].x+1, spline[x].y+2, spline[x].h, false) self.terrain:SetHeight(spline[x].x+1, spline[x].y-3, spline[x].h, false) self.terrain:SetHeight(spline[x].x+1, spline[x].y+3, spline[x].h, false) self.terrain:SetHeight(spline[x].x+1, spline[x].y-4, spline[x].h, false) self.terrain:SetHeight(spline[x].x+1, spline[x].y+4, spline[x].h, false) self.terrain:SetHeight(spline[x].x-1, spline[x].y, spline[x].h, false) self.terrain:SetHeight(spline[x].x-1, spline[x].y-1, spline[x].h, false) self.terrain:SetHeight(spline[x].x-1, spline[x].y+1, spline[x].h, false) self.terrain:SetHeight(spline[x].x-1, spline[x].y-2, spline[x].h, false) self.terrain:SetHeight(spline[x].x-1, spline[x].y+2, spline[x].h, false) self.terrain:SetHeight(spline[x].x-1, spline[x].y-3, spline[x].h, false) self.terrain:SetHeight(spline[x].x-1, spline[x].y+3, spline[x].h, false) self.terrain:SetHeight(spline[x].x-1, spline[x].y-4, spline[x].h, false) self.terrain:SetHeight(spline[x].x-1, spline[x].y+4, spline[x].h, false) self.terrain:SetHeight(spline[x].x+2, spline[x].y, spline[x].h, false) self.terrain:SetHeight(spline[x].x+2, spline[x].y-1, spline[x].h, false) self.terrain:SetHeight(spline[x].x+2, spline[x].y+1, spline[x].h, false) self.terrain:SetHeight(spline[x].x+2, spline[x].y-2, spline[x].h, false) self.terrain:SetHeight(spline[x].x+2, spline[x].y+2, spline[x].h, false) self.terrain:SetHeight(spline[x].x+2, spline[x].y-3, spline[x].h, false) self.terrain:SetHeight(spline[x].x+2, spline[x].y+3, spline[x].h, false) self.terrain:SetHeight(spline[x].x+2, spline[x].y-4, spline[x].h, false) self.terrain:SetHeight(spline[x].x+2, spline[x].y+4, spline[x].h, false) self.terrain:SetHeight(spline[x].x-2, spline[x].y, spline[x].h, false) self.terrain:SetHeight(spline[x].x-2, spline[x].y-1, spline[x].h, false) self.terrain:SetHeight(spline[x].x-2, spline[x].y+1, spline[x].h, false) self.terrain:SetHeight(spline[x].x-2, spline[x].y-2, spline[x].h, false) self.terrain:SetHeight(spline[x].x-2, spline[x].y+2, spline[x].h, false) self.terrain:SetHeight(spline[x].x-2, spline[x].y-3, spline[x].h, false) self.terrain:SetHeight(spline[x].x-2, spline[x].y+3, spline[x].h, false) self.terrain:SetHeight(spline[x].x-2, spline[x].y-4, spline[x].h, false) self.terrain:SetHeight(spline[x].x-2, spline[x].y+4, spline[x].h, false) self.terrain:SetHeight(spline[x].x+3, spline[x].y, spline[x].h, false) self.terrain:SetHeight(spline[x].x+3, spline[x].y-1, spline[x].h, false) self.terrain:SetHeight(spline[x].x+3, spline[x].y+1, spline[x].h, false) self.terrain:SetHeight(spline[x].x+3, spline[x].y-2, spline[x].h, false) self.terrain:SetHeight(spline[x].x+3, spline[x].y+2, spline[x].h, false) self.terrain:SetHeight(spline[x].x+3, spline[x].y-3, spline[x].h, false) self.terrain:SetHeight(spline[x].x+3, spline[x].y+3, spline[x].h, false) self.terrain:SetHeight(spline[x].x+3, spline[x].y-4, spline[x].h, false) self.terrain:SetHeight(spline[x].x+3, spline[x].y+4, spline[x].h, false) self.terrain:SetHeight(spline[x].x-3, spline[x].y, spline[x].h, false) self.terrain:SetHeight(spline[x].x-3, spline[x].y-1, spline[x].h, false) self.terrain:SetHeight(spline[x].x-3, spline[x].y+1, spline[x].h, false) self.terrain:SetHeight(spline[x].x-3, spline[x].y-2, spline[x].h, false) self.terrain:SetHeight(spline[x].x-3, spline[x].y+2, spline[x].h, false) self.terrain:SetHeight(spline[x].x-3, spline[x].y-3, spline[x].h, false) self.terrain:SetHeight(spline[x].x-3, spline[x].y+3, spline[x].h, false) self.terrain:SetHeight(spline[x].x-3, spline[x].y-4, spline[x].h, false) self.terrain:SetHeight(spline[x].x-3, spline[x].y+4, spline[x].h, false) self.terrain:SetHeight(spline[x].x+4, spline[x].y, spline[x].h, false) self.terrain:SetHeight(spline[x].x+4, spline[x].y-1, spline[x].h, false) self.terrain:SetHeight(spline[x].x+4, spline[x].y+1, spline[x].h, false) self.terrain:SetHeight(spline[x].x+4, spline[x].y-2, spline[x].h, false) self.terrain:SetHeight(spline[x].x+4, spline[x].y+2, spline[x].h, false) self.terrain:SetHeight(spline[x].x+4, spline[x].y-3, spline[x].h, false) self.terrain:SetHeight(spline[x].x+4, spline[x].y+3, spline[x].h, false) self.terrain:SetHeight(spline[x].x+4, spline[x].y-4, spline[x].h, false) self.terrain:SetHeight(spline[x].x+4, spline[x].y+4, spline[x].h, false) self.terrain:SetHeight(spline[x].x-4, spline[x].y, spline[x].h, false) self.terrain:SetHeight(spline[x].x-4, spline[x].y-1, spline[x].h, false) self.terrain:SetHeight(spline[x].x-4, spline[x].y+1, spline[x].h, false) self.terrain:SetHeight(spline[x].x-4, spline[x].y-2, spline[x].h, false) self.terrain:SetHeight(spline[x].x-4, spline[x].y+2, spline[x].h, false) self.terrain:SetHeight(spline[x].x-4, spline[x].y-3, spline[x].h, false) self.terrain:SetHeight(spline[x].x-4, spline[x].y+3, spline[x].h, false) self.terrain:SetHeight(spline[x].x-4, spline[x].y-4, spline[x].h, false) self.terrain:SetHeight(spline[x].x-4, spline[x].y+4, spline[x].h, false) end end
  6. Firepit is updated with new flames: http://steamcommunity.com/sharedfiles/filedetails/?id=312811332
  7. If I use Arteria3D assets I have to manually mass-remake all my materials, they only show up with a diffuse.shader and diffuse texture and the specular texture. A typical name-scheme used in arteria3d assets: diffusename.tex diffusename_nrm.tex diffusename_spec.tex So I wrote a little script to mass-remake them. (run from MinGW in windows or in Linux) #!/bin/sh excl=".meta|_n.t|_nrm.t|_s.t|_spec.t|_e.t" matlist="$(ls *.tex | grep -viE $excl | awk -F"." '{ print $1 }')" for x in $matlist do themat=$x.mat echo "texture0=./$x.tex" > $themat shader="shader=\"Shaders/Model/diffuse.shader\"" spec="specular=0.50000000,0.50000000,0.50000000,1.00000000" if [ -f $x"_nrm.tex" ]; then echo "texture1=./$x"_nrm".tex" >> $themat shader="shader=\"Shaders/Model/diffuse+normal.shader\"" spec="specular=0.50000000,0.50000000,0.50000000,1.00000000" fi if [ -f $x"_spec.tex" ]; then echo "texture2=./$x"_spec".tex" >> $themat shader="shader=\"Shaders/Model/diffuse+normal+specular.shader\"" spec="specular=1.00000000,1.00000000,1.00000000,1.00000000" fi echo $shader >> $themat echo $spec >> $themat done
  8. I can hardly attach an image to the forums, my upload says : Max. single file size: 165.89K I think uploadsizes are individual or something?
  9. 350.12 same issue. Can't this be worked around by putting some data in the buffers on your end?
  10. You still need to set blendmode, so something like this might work: Material* material = Material::Create(); material->SetColor(1,0,0,0.5); material->SetBlendMode(Blend::Alpha); model->SetMaterial(material);
  11. Yes, both fbx files are animating fine if assigned a material with an animated shader.
  12. SSLR can do this (not at zero cost) : http://www.leadwerks.com/werkspace/page/viewitem?fileid=414422238
  13. When you run the game, it will expand to your camerarange. But not in the editor.
  14. Here is a classic fisheye shader, you cn play with the zoom value and aperture values #version 400 uniform sampler2D texture1; uniform bool isbackbuffer; uniform vec2 buffersize; uniform float currenttime; out vec4 fragData0; const float PI = 3.1415926535; void main(void) { float zoom=2.0; float aperture = 178.0; float apertureHalf = 0.5 * aperture * (PI / 180.0); float maxFactor = sin(apertureHalf); vec2 tcoord = vec2(gl_FragCoord.xy/buffersize); if (isbackbuffer) tcoord.y = 1.0 - tcoord.y; vec2 uv; vec2 xy = zoom * tcoord.xy - zoom*.5; float d = length(xy); if (d < (2.0-maxFactor)) { d = length(xy * maxFactor); float z = sqrt(1.0 - d * d); float r = atan(d, z) / PI; float phi = atan(xy.y, xy.x); uv.x = r * cos(phi) + 0.5; uv.y = r * sin(phi) + 0.5; } else { uv = tcoord.xy; } vec4 c = texture(texture1, uv); fragData0 = c; }
  15. works now, just close this I have no clue..., welcome to crazy town!
  16. Trying LE reinstall, something wierd. EDIT:no, after reinstall it still persists.
  17. seems to be working now. might just be steam-hiccup that day, I have no clue, I tried several times that day, while other WS items worked. Edit: started a fresh project, just cliked New Blank in the Project Editor Now it's Error: RemoteStorageSubscribePublishedFileResult = 3 Error: Failed to subscribe to Workshop item. Error: Failed to download Workshop item.
  18. You can try http://www.leadwerks.com/werkspace/topic/7562-terrain-mipmap-adjust/page__hl__magicnumber#entry60681
  19. Leadwerks inverses vertex colors so save fbx without vertex colors.
  20. There was a thread about this somewhere I thought it all were driver realted, maybe I was wrong.
  21. This was a driver issue, fixed in 344 + drivers for nvidia. Look here for recommended drivers : http://www.leadwerks.com/werkspace/page/drivers
  22. Playing around with boxes in Silo2. Extrude and Bevel mainly. Look how crappy it looks in Silo2 and how nice it becomes in Leadwerks renderer:
  23. Here is the LE2 variant with a walking animation. https://dl.dropboxusercontent.com/u/11319604/Crawler_LE2.zip
×
×
  • Create New...