Jump to content

Josh

Staff
  • Posts

    24,635
  • Joined

  • Last visited

Everything posted by Josh

  1. Josh

    SSDO filter

    Turn down the ambient light level so the effect shows up more.
  2. Yeah, I realized the screenshot I was showing wasn't really demonstrating it.
  3. Here's a script. You need tomorrow's sync to take screenshots bigger than the program window size: http://leadwerks.com/werkspace/index.php?app=downloads&showfile=117
  4. File Name: Screenshot saver File Submitter: Josh File Submitted: 16 Feb 2010 File Category: Lua Scripts This script saves a screenshot from the editor at any resolution. Click here to download this file
  5. The terrain collision type is always 1. There is a collision property in class.lua you can change the items for to add other collision types: group:AddProperty( "collisiontype", PROPERTY_CHOICE, "None,Prop,Scene,Character,Trigger", "Collision" )
  6. It's all stuff I am implementing anyways. This gives us something to work towards in the long run, for anyone that wants to participate. I am just going to set up the basics and let the community run with it. I'm also having a lot of artwork drafted to give people something to play with.
  7. The idea is the light bounces off directly lit spots and illuminate other areas indirectly. Most real-time GI attempts use a bunch of point lights in a grid to try to simulate this effect.
  8. This is the same thing. It's finished.
  9. Josh

    SSDO filter

    The code does not need to be fixed in any way. It works the way it is supposed to. This is what it looks like. It's very similar to the SSDO effect in STALKER: Call of Pripyat:
  10. Josh

    Raycasting

    sprintf is just a weird C++ thing you need to make a string, because C++ can't just say "DrawText(result,0,0)".
  11. Josh

    lgui screenshot

    The idea is everyone can alter the code to add their own controls, or to customize the appearance. Since lua works with all languages, it makes sense to use it for some things like this.
  12. I actually wrote some new networking code a couple weeks ago. It's not released yet, but it works really well. There's a command to sync an entity over the network, and you can just move it or let physics move it, and it is synced on all other clients. We had a bunch of players on the server running around at the same time. I also just announced this project yesterday. It sounds like exactly what you are looking to create, so maybe it will help you: http://leadwerks.com/werkspace/index.php?/topic/1215-leadwerks-wars/
  13. Screen-space directional occlusion (SSDO) is the next logical step after simple screen-space ambient occlusion. This routine uses a raytracing approach to approximate global illumination. You can get my shader here.
  14. Josh

    SSDO filter

    Replace ssao.frag with this. You can adjust the raycasts, raysegments, aoscatter, and raylength values to tweak the appearance and performance: uniform sampler2D texture0; //color uniform sampler2D texture1; //depth uniform sampler2D texture2; //normal uniform sampler2D texture10; //noise texture for effects uniform vec2 buffersize; uniform vec2 camerarange; uniform float aosizereduce; uniform float camerazoom; uniform float bufferaspect; uniform float apptime; uniform mat4 cameramat4; include "depthtozposition.frag" #define aointensity 4.0 // between 1 and 5 is good #define aointensitydiv 2.5 #define aofalloff .35 #define aosamples 8 // dont change #define aopass 4 // 4 * aopass = samples #define aocut 0.6 #define aosize 0.5 #define aoscreenlocked 0 // enable this for screen locked AO float readZPosition(in vec2 texcoord) { return DepthToZPosition( texture2D( texture1, texcoord + 0.25 / buffersize ).x ); } mat3 vec3tomat3( in vec3 z ) { mat3 mat; mat[2]=z; vec3 v=vec3(z.z,z.x,-z.y);//make a random vector that isn't the same as vector z mat[0]=cross(z,v);//cross product is the x axis mat[1]=cross(mat[0],z);//cross product is the y axis return mat; } float compareDepths( in float depth1, in float depth2, in float m ) { //#define mindiff 0.1 //#define middiff 0.6 //#define maxdiff 1.6 //#define enddiff 2.1 float mindiff=0.05*m; float middiff=0.25*m; float maxdiff=1.30*m; float enddiff=1.50*m; float diff = (depth1-depth2); if (diff<mindiff) { return 1.0; } if (diff<middiff) { diff -= mindiff; return 1.0-diff/(middiff-mindiff); } if (diff<maxdiff) { return 0.0; } if (diff<enddiff) { diff -= maxdiff; return diff/(enddiff-maxdiff); } return 1.0; } // Calculates the screen-space position of a pixel // Make sure the depth lookup is using the right texture!!! vec3 GetPixelPosition( in vec2 coord ) { vec3 pos; vec2 hbuffersize=buffersize/2.0; pos.z = DepthToZPosition(texture2D(texture1,coord).x); pos = vec3((((coord.x+0.5)/hbuffersize.x)-0.5) * 2.0,(((-coord.y+0.5)/hbuffersize.y)+0.5) * 2.0 / (hbuffersize.x/hbuffersize.y),pos.z); pos.x *= pos.z / camerazoom; pos.y *= -pos.z / camerazoom; return pos; } vec3 ScreenCoordToPosition( in vec2 coord ) { vec3 pos; vec2 hbuffersize=buffersize/2.0; pos.z = DepthToZPosition(texture2D(texture1,coord).x); pos.x = ((((coord.x+0.5)/hbuffersize.x)-0.5) * 2.0)*(pos.z / camerazoom); pos.y = ((((-coord.y+0.5)/hbuffersize.y)+0.5) * 2.0 / (hbuffersize.x/hbuffersize.y))*(-pos.z / camerazoom); return pos; } vec3 ScreenCoordToPosition2( in vec2 coord, in float z ) { vec3 pos; vec2 hbuffersize=buffersize/2.0; pos.z = z;//DepthToZPosition(texture2D(texture1,coord).x); pos.x = ((((coord.x+0.5)/hbuffersize.x)-0.5) * 2.0)*(pos.z / camerazoom); pos.y = ((((-coord.y+0.5)/hbuffersize.y)+0.5) * 2.0 / (hbuffersize.x/hbuffersize.y))*(-pos.z / camerazoom); return pos; } //Converts a screen position to texture coordinate vec2 ScreenPositionToCoord( in vec3 pos ) { vec2 coord; vec2 hbuffersize=buffersize/2.0; pos.x /= (pos.z / camerazoom); coord.x = (pos.x / 2.0 + 0.5); pos.y /= (-pos.z / camerazoom) / (hbuffersize.x/hbuffersize.y); coord.y = -(pos.y / 2.0 - 0.5); return coord;// + 0.5/(buffersize/2.0); } vec4 PlaneFromPointNormal( in vec3 point, in vec3 normal ) { vec4 plane; plane.x = normal.x; plane.y = normal.y; plane.z = normal.z; plane.w = -dot(point,normal); return plane; } vec3 GetPixelNormal( in vec2 coord ) { return texture2D( texture2, coord ).xyz * 2.0 - 1.0; } vec4 GetPixelPlane( in vec2 coord ) { vec3 point = GetPixelPosition( coord ); vec3 normal = GetPixelNormal( coord ); return PlaneFromPointNormal( point, normal); } float PointPlaneDistance( in vec4 plane, in vec3 point ) { return plane.x*point.x+plane.y*point.y+plane.z*point.z+plane.w; } float rand(vec2 co) { return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); } void main( void ) { float ao=0.0; float dn; float zd; float newdepth; float angletest; float lineardepth; float depth; vec3 newnormal; vec3 newdiffuse; vec3 normal; vec2 texcoord2; vec2 texcoord = gl_FragCoord.xy/buffersize + 0.5/(buffersize*0.5); depth=texture2D( texture1, texcoord ).x; vec3 screencoord; vec4 outcolor; if (depth<1.0) { lineardepth = DepthToZPosition(depth); normal = texture2D( texture2, texcoord ).rgb * 2.0 - 1.0; normal=normalize(normal); normal.z=-normal.z; vec3 p0=ScreenCoordToPosition2(vec2(0.0,0.5),lineardepth); vec3 p1=ScreenCoordToPosition2(vec2(1.0,0.5),lineardepth); float dist = abs(p1.x-p0.x); screencoord = vec3((((gl_FragCoord.x+0.5)/buffersize.x)-0.5) * 2.0,(((-gl_FragCoord.y+0.5)/buffersize.y)+0.5) * 2.0 / (buffersize.x/buffersize.y),lineardepth); screencoord.x *= screencoord.z / camerazoom; screencoord.y *= -screencoord.z / camerazoom; vec3 newpoint; vec2 coord; vec3 raynormal; vec3 offsetvector; float diff; vec2 randcoord; float randsum = cameramat4[0][0]+cameramat4[0][1]+cameramat4[0][2]; randsum+=cameramat4[1][0]+cameramat4[1][1]+cameramat4[1][2]; randsum+=cameramat4[2][0]+cameramat4[2][1]+cameramat4[2][2]; randsum+=cameramat4[3][0]+cameramat4[3][1]+cameramat4[3][2]; #define raycasts 4//Increase for better quality #define raysegments 6//Increase for better quality #define aoscatter 1.0 float raylength = 0.5;//*dist*1.0*50.0; float cdm = 1.0;// * dist * 50.0; ao=0.0; vec4 gicolor; float gisamples; mat3 mat=vec3tomat3(normal); float a; float wheredepthshouldbe; float mix=(1.0-(clamp(lineardepth-50.0,0.0,50.0)/50.0)); //Get a random number a=rand( randsum+texcoord);// + float(53.0*m*raysegments + i*13.0) ); if (mix>0.0) { for ( int i=0;i<(raycasts);i++ ) { for ( int m=0;m<(raysegments);m++ ) { offsetvector.x=cos(a+float(i)/float(raycasts)*3.14*4.0)*aoscatter; offsetvector.y=sin(a+float(i)/float(raycasts)*3.14*4.0)*aoscatter; offsetvector.z=1.0; offsetvector=normalize(offsetvector); //Create the ray vector raynormal=mat*offsetvector; //Add the ray vector to the screen position newpoint = screencoord + raynormal * (raylength/raysegments) * float(m+1); wheredepthshouldbe=newpoint.z; //Turn the point back into a screen coord: coord = ScreenPositionToCoord( newpoint ); //Look up the depth value at that rays position newdepth = readZPosition( coord ); //If new depth is closer to camera darken ao value //rayao = max(rayao,compareDepths( lineardepth, newdepth )); //ao = min(ao,compareDepths( lineardepth, newdepth )); ao += compareDepths( wheredepthshouldbe,newdepth, cdm ); //ao+=compareDepths( lineardepth, newdepth ); } } } ao /= (raycasts*raysegments); //ao = max(ao * ao,0.5); ao = ao * mix + (1.0-mix); gl_FragColor=vec4(ao); } else { gl_FragColor=vec4(1.0); } }
  15. I have a vector in space. I want to make a ring of vectors that are offset from the original by a certain angle, so that they form a cone shape. I realize this can have multiple solutions. That's okay, as long as the resulting vectors form a cone around the original. How can this be done?
  16. We have our soldier model. Here's my concept for a troop transport. The idea is you would get everyone loaded in this thing, then head out, because it protects the players and gets a lot of people to the objective all at once. If we get to where all we have is the soldier, one vehicle, two identical factories and a run down house between them, all on a bleak landscape, in a playable game, then that's fantastic.
  17. You don't have to wait. Planning starts now, and you are all on the team. I just put out the general design plan so that we all have an idea of exactly what we are making.
  18. The roads are built asynchronously, so they take some time to show up in a large map.
  19. So what? Every game has been made.
  20. You need to adjust the directions your road nodes face to make a more natural line.
  21. I can't tell what you are trying to do from that screenshot.
  22. What ideas do you guys have?
  23. This game will be written entirely in Lua. It will be open-source and available to all licensees. The description below is not complete, but it gives you a good idea of what I have in mind. Leadwerks Wars Leadwerks Wars is a multiplayer strategic FPS game. Slower player movement changes the tactics of winning from twitch shooting to strategic attacks. It's gameplay almost as slow as Red Orchestra coupled with graphics and a slightly futuristic setting reminiscent of Crysis or S.T.A.L.K.E.R. Gameplay Gameplay revolves around capturing strategic points. Points are captured by moving a certain number of players into the capture zone and occupying the area. As the players wait, a progress bar displays the "capturing" progress. When captured, the area belongs to the capturing team, and players may then respawn from that area. Some areas have to be captured before the next area becomes available. Other areas can be captured at any time. This is determined by the map designer, and is used to make the battle flow as desired. When the final strategic point (the enemy's "base") is captured by the opposing team, the battle is won. Battles therefore move along the sequence of strategic points, advancing and retreating. Some maps may have multiple paths of progression. In this case, it is important to allocate resources to defend all vulnerable points held. Troop movement is the key to winning a battle, not twitch reactions. Player movement is slowed to realistic speeds. Realistic ballistics are used, with all the problems real gun battles are fraught with, like inaccurate bullet trajectories and weapons jamming. This leads to more strategic fighting and cover mechanics, instead of bunny hopping around at 60 MPH. Vehicles Vehicles are an important part of strategy, particularly for the purpose of troop movement. Vehicles are difficult to destroy. Troop transport This is used to move players to a destination. The vehicle moves players much faster than they could walk, and affords protection from enemy fire. This vehicle should be very difficult to destroy because it is critical to gameplay. Tank The purpose of the tank is to move a heavy weapon within range of an enemy target. Tanks are used to destroy walls and other barriers that would otherwise be impenetrable. Support Vehicle A faster support vehicle with ample firepower and one or two player crew provides cover to the tank and transport. There are no plans at this time for flying vehicles because this would impair the desired gameplay.
  24. Josh

    lgui screenshot

    The community can make that, if they really want. I don't want to spend time on it.
  25. If I were making your game, I would go ahead and complete the rest of it, and wait for new water. We'll have it implemented within six months. In the meantime, it won't affect your project much, since a submerged submarine would not get tossed around by waves. By the time you are near finishing, you'll be able to add the FFT water.
×
×
  • Create New...