Jump to content

Terrain manipulation in shaders? where are shaders?


mpatton
 Share

Recommended Posts

Hi,

I'm kind of new to 0 A.d. and was looking for a little help. I've been working on some terrain deformation test code in a opengl/glsl program I wrote that I would like to try and port into 0 a.d. for some testing. My terrain manipulation code is applied to terrain vertices in the vertex shader, so I have been looking for where terrain rendering is past to the shader in 0 a.d. I believe it is done in TerrainRender.cpp - CShaderProgramPtr shaderBase(shaderManager.LoadProgram("terrain_base", defBasic)); where the terrain shader is set, however I can't seem to find the actual vertex and fragment code for the shader. I've been looking for hours now and can't seem to find it any where. Any help as to where I can locate the vertex and fragment code for where the terrain is rendered would be greatly appreciated.

thanks in advance

Michael

May have found it... terrain_common.vp

Edited by mpatton
Link to comment
Share on other sites

The shader code is in binaries/data/mods/public/shaders/ in SVN, though if you're using one of the alpha releases you'll have to look inside the installed public.zip to find it. It looks like you're using a slightly old TerrainRenderer.cpp either way - there were quite a few changes to the shader system recently so files might be in different places if you don't update to the latest SVN version.

In the current SVN, shaders/arb/terrain_common.vp is the default vertex shader, or if you open the in-game console (F11, I think) and enter "renderer.preferGLSL=true" (or put preferglsl=true in the config file) then it'll use the GLSL version instead. There's also a bit of high-level documentation that may be relevant (though terrain uses shader effects directly, it doesn't use materials, so ignore that part).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...