Jump to content

klepto2

Developers
  • Posts

    853
  • Joined

  • Last visited

Posts posted by klepto2

  1. It seems you're not yet unlocked for the 2.3 SDK release. As you see you're still in the SDK 2.0 Group. If that changes to 2.3 Owner or the like then you will be able to download the 2.3 release.

     

    I don't know when you have purchased the update but keep in mind that the purchase is not an automated process and Josh needs to register it manually.

  2. Very Good work :)

     

    the design looks really nice. I have 3 things I would like to see asap:

     

    Core.GetSize needs to be:

    public delegate void GetSize(ref int _width,ref int _height);

     

    CustomBuffers are missing (I need them for a Leadwerks Gui Control)

     

    class Buffer is colliding with System.Buffer and needs to be resolved with Leadwerks.Buffer.

     

    My first OOP Model was based on the bmx class design to keep the source nearly identical a small class diagram:

     

    ClassDiagram3.png

  3. yeah, by the way: bmx is open enough to integrate it. I have written ides and debuggers for bmx so if you need a hand on this part i will of course help. Maybe it will become a good bmx ide replacement and alternative to Blide.

     

    But all in all your vision looks promising. I hope you can make it true.

  4. I know what you mean and I also think VS IDE is the best IDE out there. And I think your idea isn't bad but why using an IDE based on VS Shell when eg for C++ or C# developers a complete set of tools is already given and are more tested?

     

    Don't get me wrong, I will be happy if you can proove me wrong :(

  5. The idea itself sounds good, but i doubt that anything produced with the sdk will have the same comfort as the various IDEs available. Also I believe Leadwerks should concentrate to bring the engine to the next level (new tools, features etc). An IDE for every language (or even the most supported) will only disapoint users coming from other specialized IDEs (IMHO).

  6. Forget the linepicking if you want it to update in realtime. I don't know whats going wrong with the terrainElevation function but it looks much less accurate as it should be. For a single patch it linepicking slows down to 2 - 5 fps, so no option. I will look a bit deeper in it as i need this function myself.

  7. material:

    texture0="abstract::sun.dds"
    clamp0=0,0,0
    blend=1
    depthmask=0
    depthtest=1
    overlay=1
    zsort=1
    cullface=1
    castshadows=0
    specular=1.00000000
    bumpscale=1.00000000
    gloss=0.500000000
    shader="abstract::mesh_diffuse.vert","abstract::mesh_diffuse_alphablend.frag"
    shadowshader="abstract::mesh_shadow.vert",""
    

     

    As MasterXilo already said, if you use alphablend textures within the mainworld it can produce unwanted effects. eg if you use this material in the mainworld you would just see brighter legs of the model but nothing on the terrain. Building it as a shader is my next step. I have done it with my own engine previously and i know it is more accurate then the non gpu approach.

  8. Of couse you can paint it with a material :lol:

     

    decaltextured.jpg

     

    I will work on it a bit more and then I will post it in the archives.(I planned this feature for later but now i can also finish it;) ) there are some issues if the terrainelavtion is not giving exact values.

    Also you may need to set it to the transparent world if you need to use alpha textures like the above.

  9. I have put together a small prototype in my test application (Blitzmax) :

     

    Alignedplane.png

     

    And thats the code of the class:

     

    Type TTerrainPlane
    Global list:TList = New TList
    Global terrain:TTerrain
    
    Field Mesh:TMesh
    
    Method New()
    	list.AddLast(Self)
    End Method
    
    Function Create:TTerrainPlane(parent:TEntity, Scale:Float = 1.0)
    	Local p:TTerrainPlane = New TTerrainPlane
    	p.Mesh = CreatePatch(32, 32, parent)
    	ScaleMesh(p.Mesh, [scale, 1.0, Scale])
    	MoveEntity(p.Mesh, [- Scale / 2.0, 0.0, -Scale / 2.0])
    	Return p
    End Function
    
    Function SetTerrain(t:TTerrain)
    	TTerrainPlane.terrain = t
    End Function
    
    Function Update()
    	If terrain = Null Then Return
    
    	For Local Plane:TTerrainPlane = EachIn list
    		Plane.Calculate()
    	Next
    End Function
    
    Method Calculate()
    	For Local Si:Int = 1 To Mesh.CountSurfaces()
    		Local surf:TSurface = Mesh.GetSurface(Si)
    		For Local Vi:Int = 0 To surf.CountVertices() - 1
    			Local vertex:TVec3 = TFormPoint(surf.GetVertexPosition(Vi), mesh, Null) ;
    			Local newpos:TVec3 = Vec3(vertex.X, TerrainElevation(terrain, vertex.X, vertex.Z) + 0.01, vertex.Z)
    			surf.SetVertexPosition(Vi, TFormPoint(newpos, Null, Mesh))
    		Next
    	Next
    End Method
    End Type
    
    Function CreatePatch:TMesh(xsegs:Int = 1, zsegs:Int = 1, parent:TEntity = Null)
      Local x:Int,z:Int
      Local mesh:TMesh
      Local count:Int
      Local surf:TSurface
    
      mesh = CreateMesh(parent)
      surf=mesh.AddSurface()
      For z=0 To zsegs
         For x=0 To xsegs
            count=surf.AddVertex([Float(x)/Float(xsegs),0.0,Float(z)/Float(zsegs)],[0.0,1.0,0.0],[Float(x)/Float(xsegs),1.0-Float(z)/Float(zsegs)])
            If x>0 And z>0
               surf.AddTriangle(count-1,count,count-xsegs-1)
               surf.AddTriangle(count-1,count-xsegs-1,count-xsegs-2)
            EndIf
         Next
      Next
      mesh.Update()
      Return mesh
    EndFunction
    

     

    Maybe this helps.

  10. There is another Terrainfunction called TerrainEvaluation, this will give you the correct height value. the terrainheight function must be muliplied by the terrain y-scale value. x,y = x,z it is just y because you actually read from a texture in 2d space not 3d. the interpolation is because calculating the correct value (eg: fining the correct chunk, finding the correct triangle and then finding the point in triangle) is far to slow for these kind of things. The interpolation takes the 4 nearest full pixel values of the point (the point itself is a float) and performs a cubic interpolation between these points (weighting is based on distance from the real point to the full pixel). This technique is much faster and as long you don't have really oversized tilesizes it is accurate enough.

  11. I missed your 3rd point where you handle the height issue (which will result in the 1 long raycast I've mentioned). As said: I would go the "terrainheight" way or the shader way. But there is also a cheaper raycast method: Do it the other way round ! Do a raycast from the vertex position at zero level (x,<=0, z) and do raycast up to the real vertexposition. Now just add an offset and you will have the same result but with generally lower raycast lengths.

     

    Well the number of raycasts depends on the pc the application is running on. It can run smooth with yours but can be very slow on other machines.

  12. Doesn't sound bad but doing a raycast for all vertices may cost lots of cpu power. Remember that you need 2 raycasts with short ranges or 1 with a range of maximum terrainheight - vertexY because you don't know if the point is above or below the terrain.

     

    I believe you have 2 options here:

    1. Use directly the Terrainheight function which interpolates the height at given points / may be also cpu heavy and depends highly on used vertices.

    2. Write a meshshader which aligns the vertices on thy fly to the terrainheight. Terrainheightmap and everything else needed for this should be available in the shader pipeline.

  13. I would try to make my own CreatePlane function. Somewhere in this forum was a sample function posted by Josh (maybe the old forum).

    Also you may have a look at the road script. there you find code how to morph / align vertices to the terrain height. for optimal results you have to adjust the vertex spacing to fit the terrain resolution.

     

    Also there was a thread about terrain decals (by TylerH if i remember correctly) which looks like the thing you want.

  14. I'm currently working on my loading and setup routines and I think it may be useful to have some kind of callback for the LoadScene function.

    Currently my scene is relatively small and small splashscreen is enough for indicating loading. But i if the scene files grow and

    the loading of a scene takes much longer i would like to present progress on my loading screen.

     

    Maybe you can add a callback as an optional parameter to the loadscene function:

     

    main_scene = LoadScene("abstract::map_x_1_y_2.sbx", LoaderProgress)
    
    Function LoaderProgress(progress:TSceneProgress)
    DrawImage(splash, 512.0 - loadimg.Width() / 2.0, (768.0 / 2.0) - (loadimg.Height() / 2.0))
    Local total:Int = progress.GetTotalItems()
    Local loaded:Int = progress.GetLoadedItems()
    DrawText "Loading... " + (loaded / Float(total)) * 100 + "%",20,20
    Flip()
    End Function
    

  15. The black sky was a problem i had myself as i have switched from lua back to bmx for my main project.

     

    Have you done:

    'To Generate an updated lua-gluefunctions.bmx uncomment the lines tagged [1]
    'and comment out the line tagged [2]. Run the code once, then swap back.
    'lua-gluefunctions.bmx needs to be inside the App directory.
    
    Import "PATH TO YOUR 2.3 SDK FOLDER\BMX\Framework\framework.bmx"
    'Import lugi.generator '[1]
    
    Include "lua-gluefunctions.bmx" '[2]
    'generateGlueCode("lua-gluefunctions.bmx") '[1]
    'End '[1]
    

     

    Also you need the script folder (which you find in the root directory of the editor) in the folder your app is in. After I have done this i could load the scene as if i have opened it in the editor.

  16. WOW, looks really nice. Nice to know what you needed the shader pix to worldpos code for ;)

     

    Some questions :)

     

    How will physics work together with this?

    Did you think about to use some region mapping eg a modified heightmap/alphamap where you can setup lakes in different heights?

  17. Hi,

     

    The problem:

    I have a nice terrain with a nice colormap. I have created a sbx file with this terrain, the colormap with setting "Fit to Terrain" enabled.

    In the editor it looks really nice but using Loadscene on the sbx file just shows the texture tiled and not streched over the terrain.

     

    Any idea how to enable this? Or is it a bug or thing which is missing?

     

    thx in advance

  18. No, unfortunalty this still doesn't work. I have installed tao but nothing helped. If you're interrested I would like to help you with this and give me the source for testing purposes only. btw. the exe is still a x64 managed one. it seems you haven't used the correct settings.

     

    MSN: klepto2 (at) hotmail.de if you're interessted.

  19. this is how to calculate the pixel position in world coords:

     

    //needed uniforms in eg postfilter.frag
    uniform vec3 cameraposition;
    uniform mat4 cameramatrix;
    
    vec3 screencoord;
    vec4 fogcoord;
    
    screencoord = vec3(((gl_FragCoord.x/buffersize.x)-0.5) * 2.0,((-gl_FragCoord.y/buffersize.y)+0.5) * 2.0 / (buffersize.x/buffersize.y),DepthToZPosition( depth ));
    screencoord.x *= screencoord.z;
    screencoord.y *= -screencoord.z;
    
    vec4 worldpos = vec4(screencoord,1.0) * cameramatrix;
    
    worldpos += vec4(cameraposition,0.0);
    

     

    Needed Shader variables to be set

    SetShaderVec3(postfilter,"cameraposition",camera.position);
    SetShaderMat4(postfilter , "cameramatrix" , GetEntityMatrix(Camera).Inverse() ) ;
    

  20. thx laurens, I'm not using the Express Versions anymore abd last time i have searched for this issue the project file thingy was the only i could found.

    Also i have to apologize because it seems that the emitter editor just uses tylerH's Wrapper and not this one.

     

    I have tested this assembly and it works very well.

     

    Keep up the good work.

×
×
  • Create New...