Rastar Posted January 20, 2014 Share Posted January 20, 2014 1) The Lua API doesn't provide methods for getting or setting the pixels of a texture. Is this due to technical reasons, or could those methods be exposee? 2) I have no success in importing a 16bit greyscale image (tried various formats). Is this not supported? Quote Link to comment Share on other sites More sharing options...
DudeAwesome Posted January 20, 2014 Share Posted January 20, 2014 1) seems to be cpp only 2) .raw? Quote It doesn´t work... why? mhmmm It works... why? Link to comment Share on other sites More sharing options...
Josh Posted January 20, 2014 Share Posted January 20, 2014 SetPixels requires a pointer to memory, which Lua does not support. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Rastar Posted January 20, 2014 Author Share Posted January 20, 2014 OK, I see? @dude: What do you mean by .raw? Like raw image data? That doesn't work as well. @Josh: I see in the terrain.shader you get the terrain height from the second row of the entity matrix. So I guess this is where the 16bit raw data from imported heightmaps go, spread over two channels or so? Quote Link to comment Share on other sites More sharing options...
Josh Posted January 20, 2014 Share Posted January 20, 2014 The height map is a texture that gets read for each point's height. This is in the vertex shader. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
shadmar Posted January 20, 2014 Share Posted January 20, 2014 @Rastar L3DT can export raw (unsigned/signed16 bit), Bryce7, and GIMP with a plugin I believe. Possibly others. Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
Rastar Posted January 20, 2014 Author Share Posted January 20, 2014 Ah, you're referring to the clipmader.shader, right? This is reading from the red channel - so is this an 8bit or 16bit texture? And if the latter, what do I have to do to import and use one myself? EDIT: Sorry, talking rubbish, of course the heightmap sampling's taking place in terrain.shader. Either wasn't looking or thinking straight... Quote Link to comment Share on other sites More sharing options...
Rastar Posted January 20, 2014 Author Share Posted January 20, 2014 My problem is not that I can't create a .raw file and import that for the Leadwerks terrain, but rather that I would like to do heightmap displacement myself. So I need to get that texture to the shader, and 8bit resolution isn't enough. I guess I could encode this in two channels, but maybe there's an easier way. Quote Link to comment Share on other sites More sharing options...
Rastar Posted January 21, 2014 Author Share Posted January 21, 2014 OK, searched a bit further, and this seems to be common among game engines: While OpenGL supports 64bit textures, most engines just allow up to 8 bits per channel. I am calculating the normal map for a heightmap-displaced terrain in the fragment shader using central differencing, and for this 8bit just isn't enough (it produces ugly steps in the terrain). However, World Machine allows to export heightmaps in a "Povray TGA" format, where the 16 bits are spread over the red and green channels. So I went ahead and used that. As a comparison, this is using an 8bit heightmap and here I am using the 16bit/2 channel format Pretty amazing what a normal map (even a calculated one) can add, the base mesh for this terrain is just 65x65 vertices, no tessellation or anything. Since I'm calculating the normals in the fragment shader - is there a way I could render this to a texture and sample the texture later on? Using the current Lua API? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.