Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

349 Neutral

About Ruggostein

  • Rank

Personal Information

  • Interests
  1. Buckeye, very useful post, it helped me understand better the transformations. However my joints are not represented just as translations from the parent (sadly...). The joints are represented as a rotation + translation pair, which is one of the reason everything was so confusing. I tried finding a way to eliminate the rotation and keep only translations, by trying to apply a inverted rotation to the animation dat, but I had no sucess, I'm doing something wrong.   Ashaman73, I actually need it because I want to automatize targeting more than 300 models (which all have skeletons with same hierarchy, but different joint positions), along with being able to do some other cool stuff at run time (eg: create characters procedurally by patching together different body parts).   And I don't think it is that much difficult if the skeletons have the exactly same hierarchy. For example the devs from Overgrowth did it, also jMonkey engine supports this and the code is open source, I've checked it, and it is not more than 300 lines of code (altough the code uses some naming conventions for matrices that completly confuse me).   Check this link for a example of what I want to do: http://hub.jmonkeyengine.org/t/animation-retargeting-mocap-bvh/29985/2
  2. I've been trying doing this for probably 3 years, and still not had any success, and sadly there is almost no information about this online.   Basically, I want to reuse animations from one skeleton on another. Both skeletons have exactly the same hierarchy of joints, except that each roint has a different offset matrix (position + rotation).   The best result I can get is by just copying the offset matrices from the original skeleton to the target skeleton (animation below). Of course, this ignores completely the original skeleton, so this solution can't work.   If I get the idea right, ideally I just have to calculate a matrix per each joint, that converts the animation data from the original bone to the target bone orientation.   I though this would be done like this.   transformed_keyframe_mat =  inverted_original_offset_mat * original_keyframe_mat * target_offset_mat This however does not work, and in frustration I've tried all possible permutations of this multiplications, the animation always appears all wrong (head twisted inside body, paws twisted and stretched, etc).       My current animation algorithm works like this (with many parts I not understand!)   1 - Each joint has two precalculated matrices (a relative and a absolute offset matrix). The absolute offset matrix can be used to bring vertices from the joint space to the world space. And the relative matrix I have no clue what transformation it actually does if I apply it to vertices.   2 - After selecting the keyframes for current time and interpolating them, I get a keyframe/animation matrix for each joint. I call this 'relative frame matrix'. I then concatenate them to obtain a 'absolute frame matrix' per joint.   3 - I calculate the final matrices for each joint by multiplying the inverse of the 'absolute offset matrix' by the  'absolute frame matrix'. This supposedly brings the vertices to 'joint space', then applies the current animation and then somehow puts them back in world space (why?? I'm not sure how this even is working now... I've written this code like 4 or 5 years ago) I'm not sure if there is even another way to do this. For example, is is possible to avoid concatenating all 'relative frame matrices' into 'absolute frame matrices' every frame?  I've tried that, but I did not have any sucess, the animation always appears wrong. Finally, where would the retargeting step happen?
  3. Ruggostein

    Question about Frac() in GLSL shader

    I'm not sure I understand what you're trying to say, you're talking about sampling the textures, and the calculation of the UVs comes before that.   If I pass a quad to OpenGL with top left corner with UVs (0, 0) and bottom right (1.0, 1.0) those are the exact values that reach the fragment shader.   Doing just frac() on those UVs will return 0.0 to all of them and only then I sample the textures using tex2D(), so the values will be all wrong.
  4. Ruggostein

    Question about Frac() in GLSL shader

    Just ran that formula through a couple values in my head, seems to work, yes, thanks, I'll confirm it later when I'm home :)
  5. Ruggostein

    Question about Frac() in GLSL shader

    The problem is that I dont have have a specific N value. I'm trying to implement a scheme to allow virtualization of textures, meaning the models will come with UVs with a generic range, some will have 0..1 UVs, others use larger values for wrapping textures. What I'm trying to do is automatically pack tons of small textures into a huge texture, so I can draw everything in a single draw. So in the vertex shader I will convert the UVs from the original range to the UV that corresponds to the sub rect in the generated texture atlas.   In this case the texture atlas will be updated with some frequency, as I'm trying to do some texture streaming, so I can't just generate the atlas once and update the uvs in the cpu.   Your suggestion could work, but I'm afraid it will introduce texture sampling errors.
  6. When doing frac(X) it returns the fractional part of X, as we all know. And this is a value in the range 0 to 0.99999999...., never 1.0, is this correct?   I'm trying to find a way to calculate frac(x) that can be used for texture coordinates, where the input will be any UV from 0 to a large number, which I want to to convert to 0..1 range.   Because if we have for example a quad with uvs from 0 to 1, doing frac() on them would turn all UVs into zero.   Of course, I could use a if like this   dest_u = frac(src_u); if (dest_u <=0.0) {  dest_u = 1.0; }   But I need this for mobile phones, including old 2.3 Android devices (openGL ES), so I'm trying to find a math solution that does not require ifs. I know that in some situations it is possible to use min() and max() to replace some ifs, but in this case I'm not finding how to get there, anyone have an idea?
  7. Ruggostein

    Keeping camera inside map bounds

      The camera is defined by two things, position and view direction. Constraining the position to a box is trivial, sure, but the problem is constraining the view direction so the limits of the map are never visible.   My camera view direction vector can have any value except having the Y component pointing up (to the sky). So I'm interested in knowing what kind of math could be used in this case.
  8. I have a 3d game where players can explore small maps. Each map is bounded by walls, except for some exits. Right now if players come close to an exit, they can look outside the map and see a skybox, this is bad.   I want the camera to be able to roam free, except in places where it would let players see outside. There are some contraints, for example the camera always points down, so it is not possible to see the sky.   What kind of approach should I take?
  9. Ruggostein

    Color grading shader

    Ah yes, I overlooked that part about precise coordinatse.   Yes true, but I'm not just looking up one single color at nearest, I'm interpolating between two colors, so I think I get much more than that. I've got this shader running in my game, I applied it to everything from GUIs to scene drawing and did not notice any color loss, especialy nothing similiar to a posterize effect.   However as Hodgman said, I understand now that in the 2d LUT case this manual interpolation should be done only for the blue component, as is the only one that cannot really be interpolated via texture filtering.
  10. Ruggostein

    Color grading shader

    Thanks Hodgman, thats lots of useful information there. However that bit about using linear vs nearest, there was reason why I did not use linear (I might be wrong though, correct me if thats the case). This 2D texture is basically emulating a 3D texture, so we can think of it as a series of slices (arranged horizontally). If the shader tries to lookup a color in the LUT that falls near the "slices" borders, it will interpolate between two slices, and that will produce very wrong results (eg: mixing very light colors with dark colors). What solution you can think to avoid this problem when using linear filtering?   But the problem why I created the topic is that in my laptop, the results are completly wrong for some of the pixels (eg: some pixels appeared magenta when they should appear dark blue). In all other devices, from PCs running Windows, OSX and lots of mobile devices, the results at least it looks good to the eyes (might be not exactly correct if we compare the exact in and out RGB values, as you said, this shader is missing some details. However as I said in my previous post, this particular issue was fixed just by disable Catalyst AI option (this laptop has a ATI card, around 4 years old). Might be old drivers, or just the way the "catalyst AI" setting works, I'm not sure, but it somehow was altering the texture pixels/quality/size.
  11. Ruggostein

    Color grading shader

    Hi, thanks, did not know about textureFetch(), however it does not existe in GL ES 2.0. By the way, I found the problem, and it was really stupid...   Disabling ATI Catalyst AI setting fixes it! I guess this setting was making the texture into a 16 bit texture instead of 32 bit or something else really funky that did mess with the results... Anyone has a clue what could cause it, and if there is a way to hint the drivers to not mess with the textures?
  12. I'm trying to implement a shader that allows to do color grading using a 2D texture. 2D because I need it to run on all mobile devices capable of OpenGL ES 2.0.   The lookup table textures used for color grading look like this.   The Y axis contain the green values, the X axis contains both R and B. This is the same format used by Unreal engine for color grading.   My shading works on all of my mobile devices, works on my desktop with an AMD card. Does not work properly in my laptop that has an ATI card though, some pixels get completly wrong colors, most look perfecty good..   This is shader, can someone find any problem with it? uniform sampler2D color_table_texture; // LUT texture with nearest filter, mipmaps off uniform mediump float color_table_elements; // LUT.Height uniform mediump float color_table_scale; // 256 / LUT.Height uniform mediump vec3 color_table_clamp; // vec3(LUT.Height-1) lowp vec3 ColorTableLookup(mediump vec3 color) { mediump float base_value = 255.0; mediump vec3 rescaler = vec3(base_value, base_value, base_value); color *= rescaler; // convert to 0..255 range color /= color_table_scale; // convert to LUT range (0..LUT.HEIGHT) mediump vec3 delta = fract(color); // get interpolation value mediump vec3 rgb1 = floor(color); // get lower color mediump vec3 rgb2 = ceil(color); // get higher color rgb2 = min(rgb2, color_table_clamp); // clamp to LUT.height-1 // loop up first color mediump vec2 ofs = vec2(rgb1.r + rgb1.b * color_table_elements, rgb1.g); ofs.x /= (color_table_elements*color_table_elements); ofs.y /= color_table_elements; mediump vec3 temp = texture2D(color_table_texture, ofs).rgb; // loop up second color ofs = vec2(rgb2.r + rgb2.b * color_table_elements, rgb2.g); ofs.x /= (color_table_elements*color_table_elements); ofs.y /= color_table_elements; mediump vec3 temp2 = texture2D(color_table_texture, ofs).rgb; // interpolate return mix(temp, temp2, delta); } Note that while here I'm doign two lookups and interpolating, I also tried a trimmed down version that only did one lookup, no interpolation, the problem still happens. I've tried so many things, it seems that some of the texture reads result in wrong lookups. I don't know if this is a precision issue during generation of the offsets for lookup. Is there a way to access a texture using integer pixel coordinates (1..Texture.Size) instead of 0...1? Or what else could be the problem?
  13. Ruggostein

    Next step, making a company?

    Thanks Andy, that seems a good point, something that I need to investigate, maybe be similar to US, or different, I really need to check!
  14. Ruggostein

    Next step, making a company?

      I did not know it it was against rules to link the game, but here it is the link for the Android version: https://play.google.com/store/apps/details?id=com.terra.minimon3d   However, I did some kinda experimental with this game, I released the game in a beta state for Android, in order to get enough feedback about features, bugs etc, something similar to Steam Early Access, altough for free. The initial versions were buggy, and simply did not work in many devices, so I lost a big chunk of players because of that. Others continued playing since the very start, and gave a lot of feedback.   I did make some money from it, but much was invested back in improving graphics or paying for server costs etc. But of course, the sales are increasing with each month, since the player base continuous growing, and now with the Steam release it will probably be more popular.   What advantages are there in having an company, if I am just one guy? I think there might be differences in terms of taxes and stuff, but course, that is something that I need to investigate myself, people here don't know my country laws. A friend told me it would look more "professional" to have a real company, but other than that, are there other advantages?
  15. So, I've made a game (a 3D MMO), that I first published for mobile phones, and recently got the computer version accepted on Steam (through Greenlight).   When I first published the game in mobile, I did it under my personal developer account. While I did not any marketing of the game, I still got around 100 thousand downloads. "organic" downloads, is that what you call them? My logic is, the visibility in the mobile market is almost null, and still I got lots of downloads, so in Steam people probably many will probably find my game. To tell the truth, I don't really know what to expect of Steam in terms of sales and such. My question is, should I make a company or just continue doing business as an individual?   Some facts: - I'm the total owner of the game, made most of it myself, the rest was done by remote contractors - I've thought about the possibility of getting an artist working together with me full time (either for a % of sales or a fixed ammount per month?) - I don't live in the USA, I live in Portugal. Making a company here costs around 400$ to start, but I'm not sure if there's any extra cost  (maybe accountant?)
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!