Jump to content

sangbo

Community Members
  • Posts

    6
  • Joined

  • Last visited

sangbo's Achievements

Tiro

Tiro (1/14)

0

Reputation

  1. Hi again, We're working on modifying ShaderProgram.cpp to get ARB to recognize vertex attribute pointers, and we are having trouble conceptualizing what needs to be done here. The idea that we think is the appropriate way to handle things is to dissect the attribute array so that we can include the data as texture coordinates. But the problem is, what if we run out of texture coordinates? Resorting to local variables does not seem like a very practical solution. Also, we're not sure how to view wraitii's patch, so we can't exactly see how he attempted to solve this problem. Is gpu skinning possibly enabled in the ARB shader? We were under the impression that it cannot be used and has ignored shader code relevant to gpu skinning for now. Is our assumption correct?
  2. Hi. The code below is part of the translation for the model_common vertex shader (only the section on wind is not yet translated). We are relatively new to ARB shader language and so we are hoping to get some feedback on whether we are on the right track. While translating, we noticed some uniform variables (e.g. shadowScale, windData) that were used in the shader which needs to be called in the vertex shader, but we were not able to find the location where these variables were set (to get the index into program.local). So, where are the following variables set: cameraPos, sunDir, sunColor, losTransform, shadowTransform, instancingTransform, shadowScale, sim_time, windData ? !!ARBvp1.0 PARAM cameraPos = program.local[0]; PARAM sunDir = program.local[1]; PARAM sunColor = program.local[2]; PARAM losTransform = program.local[3]; PARAM shadowTransform[4] = { program.local[4..7] }; PARAM instancingTransform[4] = { program.local[8..11] }; #if USE_SHADOW_SAMPLER && USE_SHADOW_PCF PARAM shadowScale = program.local[12]; #endif #if USE_WIND PARAM sim_time = program.local[13]; PARAM windData = program.local[14]; #endif OUTPUT v_lighting; OUTPUT v_tex = result.texcoord[0]; OUTPUT v_los = result.texcoord[1]; #if USE_SHADOW OUTPUT v_shadow = result.texcoord[2]; #endif #if USE_INSTANCING && USE_AO OUTPUT v_tex2 = result.texcoord[3]; #endif #if USE_SPECULAR || USE_NORMAL_MAP || USE_SPECULAR_MAP || USE_PARALLAX_MAP OUTPUT v_normal = result.texcoord[4]; #if USE_INSTANCING && (USE_NORMAL_MAP || USE_PARALLAX_MAP) OUTPUT v_tangent = result.texcoord[4]; #endif #if USE_SPECULAR || USE_SPECULAR_MAP OUTPUT v_half = result.texcoord[5]; #endif #if USE_INSTANCING && USE_PARALLAX_MAP OUTPUT v_eyeVec = result.texcoord[6]; #endif #endif //// Compute position and normal: #if USE_INSTANCING TEMP position; TEMP normal; DP4 position.x, instancingTransform[0], vertex.position; DP4 position.y, instancingTransform[1], vertex.position; DP4 position.z, instancingTransform[2], vertex.position; MOV position.w, 1.0; DP3 normal.x, instancingTransform[0], vertex.normal; DP3 normal.y, instancingTransform[1], vertex.normal; DP3 normal.z, instancingTransform[2], vertex.normal; #if (USE_NORMAL_MAP || USE_PARALLAX_MAP) DP3 tangent.x, instancingTransform[0], vertex.tangent; DP3 tangent.y, instancingTransform[1], vertex.tangent; DP3 tangent.z, instancingTransform[2], vertex.tangent; #endif #else ATTRIB position = vertex.position; ATTRIB normal = vertex.normal; #endif #if USE_WIND TEMP wind; MOV wind, windData.xy; // ... #endif DP4 result.position.x, state.matrix.mvp.row[0], position; DP4 result.position.y, state.matrix.mvp.row[1], position; DP4 result.position.z, state.matrix.mvp.row[2], position; DP4 result.position.w, state.matrix.mvp.row[3], position; //// Compute lighting: #if USE_SPECULAR || USE_NORMAL_MAP || USE_SPECULAR_MAP || USE_PARALLAX_MAP MOV v_normal, normal; #if USE_INSTANCING && (USE_NORMAL_MAP || USE_PARALLAX_MAP) MOV v_tangent, tangent; TEMP normalXtangent; XPD normalXtangent, v_normal.xyz, v_tangent.xyz; TEMP bitangent; MOV bitangent, normalXtangent, a_tangent.w; MOV v_normal.w, bitangent.x; MOV v_tangent.w, bitangent.y; MOV v_lighting.w, bitangent.z; #endif #if USE_SPECULAR || USE_SPECULAR_MAP || USE_PARALLAX_MAP // eyeVec = cameraPos.xyz - position.xyz; TEMP eyeVec; SUB eyeVec.xyz, cameraPos, position; #if USE_SPECULAR || USE_SPECULAR_MAP // v_half = normalize(-sunDir + eyeVec); TEMP half; SUB half.xyz, eyeVec, sunDir; DP3 half.w, half, half; RSQ half.w, half.w; MUL v_half.xyz, half, half.w; #endif #if USE_INSTANCING && USE_PARALLAX_MAP MOV v_eyeVec, eyeVec; #endif #endif #endif // v_lighting.xyz = max(0.0, dot(normal, -sunDir)) * sunColor; DP3 lighting, normal, -sunDir; MAX lighting, 0.0, lighting; MUL result.color, lighting, sunColor; //// Texture coordinates: MOV v_tex, vertex.texcoord[0]; #if USE_INSTANCING && USE_AO MOV v_tex2, vertex.texcoord[1]; #endif #if USE_SHADOW // v_shadow = shadowTransform * position; DP4 v_shadow.x, shadowTransform[0], position; DP4 v_shadow.y, shadowTransform[1], position; DP4 v_shadow.z, shadowTransform[2], position; DP4 v_shadow.w, shadowTransform[3], position; #if USE_SHADOW_SAMPLER && USE_SHADOW_PCF // v_shadow.xy *= shadowScale.xy; DP2 v_shadow.xy, v_shadow.xy, shadowScale; #endif #endif MAD v_los, position.xz, losTransform.x, losTransform.y; END
  3. We are working on the translation, and we have a few questions: 1. Do ARB shaders read parameters passed in from the c++ program in the same way that GLSL shaders do? Where in the c++ code are the parameters defined and passed into the shaders? 2. Is there a way to test if our translation compiles/works/runs? 3. How do we submit our code to the development team for inspection after we are done?
  4. Hello! Thanks for the great suggestion! We would love to do it! We have some background in computer graphics, but limited knowledge about GLSL and ARB assembly shaders. If possible, could you provide some information that can help us get started? Thanks!
  5. Hello, I'm trying to build the 0 AD source on my Ubuntu 11.04 laptop by following the instructions here http://trac.wildfiregames.com/wiki/BuildInstructions, but unfortunately, these instructions are for Ubuntu 12.04 and higher. I'm wondering if someone can provide some instructions for 11.04. In particular, I would like to know what packages I need to install to get the build to succeed. As for my current problem, I'm running update_workspaces.sh, and it is complaining that I don't have NVTT. I tried running sudo apt-get install libnvtt-dev, but this package doesn't exist for some reason. Is there a way to get this package onto 11.04? Thanks.
  6. Hello! We are Sang Tian and Boya Yang and we are two college undergraduates (junior and senior) from Carnegie Mellon University. We are very interested in contributing to this open source game for a term project for a class called "Foundations of Software Engineering". We have some experience with programming in C++ and OpenGL and we plan to spend approximately 50 hours working on this project. We are wondering whether there are any specific features of this game that we can help to implement or improve. All suggestions welcome! Again, we are very excited to begin working on this awesome game! Thanks! Sang Tian and Boya Yang
×
×
  • Create New...