Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

115 Neutral

About gearifysoftware

  • Rank

Personal Information

  • Interests
  1. So I am at the point where I am optimizing and profiling my game and trying to decide what my minimum requirements should be. I am using OpenGL 4.2. I want my game to be accessible to the casual gamer, or someone that does not have a souped up, or bleeding edge machine - especially since my engine is not using bleeding edge rendering techniques (it looks more like an Xbox 360 game). I have modest polygon counts and not huge numbers of models. At the same time, I don't want to optimize for a dinosaur machine.  Ideally I think I would at least like my game to run at 1080p @ 30hz. I expect I'll be ready to release around a year from now (its not a huge project). I get that a lot of this is dependent on the details of the game, and some of those details are yet to be pinned down since the game is still in development, but I am thinking that 2010 era, non-gaming laptops are just setting the bar a little too low at this point. At the moment I am eyeing some gaming desktops on Amazon around the $400 range. A couple years old. Suggestions and advice are appreciated. Note I am looking for both a desktop tower and a gpu recommendations (complete packages are nice too). Thanks! 
  2. gearifysoftware

    Noticable seams when blending textures

    Awesome. Thanks so much for your help, JoeJ!
  3. gearifysoftware

    Noticable seams when blending textures

    Thanks for the response, JoeJ. Based on your response, I tried the following (I didn't do any clamping though)   vec4 ComputeTexture(vec2 TexCoord, sampler2D rock, sampler2D grass, sampler2D stony_grass, sampler2D stone) { vec3 _Normal = normalize(Normal); float grass_weight=1.0f; float stone_weight=0.0f; if (_Normal.y <= 0.950f) { grass_weight=1.0f; stone_weight=0.0f; } else if (_Normal.y <= 0.99f) { grass_weight=myInterp(0.95f,1.0f,0.99,0,_Normal.y); stone_weight=(1.0f-grass_weight); } else { grass_weight=0.0f; stone_weight=1.0f; } vec4 color=grass_weight*texture(grass,TexCoord)+stone_weight*texture(stone,TexCoord); color.a=1.0f; return color; } That fixes the seams! I really don't know why though... haha
  4. For my terrain I have 4 available textures which I am choosing/blending based on the pixels coordinates and the surface normal. For example I can choose to use a rocky texture for steep slopes, grass for low elevation, snow for high elevation, etc. Right now I am testing the function just blending two textures.When the texture normal.y is less than 0.95 I use the grass texture. When the texture noramal is greater than 0.99 I use the stone texture. When in-between, I linearly interpolate between the two.  Here are the driving functions: float myInterp(float x1, float y1, float x2, float y2, float x) { float m=(y2-y1)/(x2-x1); float b=y1-m*x1; return (m*x+b); } vec4 ComputeTexture(vec2 TexCoord, sampler2D rock, sampler2D grass, sampler2D stony_grass, sampler2D stone) { vec3 _Normal = normalize(Normal); if (_Normal.y <= 0.950f) { return texture(grass, TexCoord); } if (_Normal.y <= 0.99f) { float weight=myInterp(0.95f,1.0f,0.99,0,_Normal.y); vec4 color= ( texture(grass, TexCoord)*weight + texture(stone, TexCoord)*(1-weight)); color.a=1.0f; return color; } return texture(stone, TexCoord); } Here is the result: Notice the seams just outside and running parallel to the stone paths. I've observed the seams seem to occur for far away pixels and disappear when viewed up close. My textures files are seamless textures, and as is shown in the code, the texture coordinates are the same, it is only the choice of texture that is changing (and the blend weights). I made sure all textures are of the same resolution, file type, and their sizes are powers of 2.  Any idea what could be causing this?
  5. gearifysoftware

    Is this a v-sync issue?

    Thank you both so much for your insightful responses! That resolves my texturing issue, but I am still having a few distortions when moving/rotating vertically.  I'll need to get another screen capture for it. Will update later. Thanks again!
  6. gearifysoftware

    Is this a v-sync issue?

      Thanks for the response.    I was using GL_LINEAR for my texture magnification and minification, which I believed would handle this.  I tried replacing this with: GL_LINEAR_MIPMAP_LINEAR, and it very nicely cleaned up the grass texture.   I had thought that GL_Linear would have handled the averaging of the texture elements though? I don't know why it would require mip-map to not create so much noise. I am, still, seeing some weird visual distortions when panning/rotating the view vertically, so it looks like I may have two issues at work here, but I'd like to just figure out what's going on with the texture first, before looking at that.
  7. I am using OpenGL 4.x with SDL2 for my window initialization. Running on an HP laptop with an NVidia Quadro K1100M. I believe I have the necessary configurations set for vsyncing, such as: SDL_GL_SetSwapInterval(1); SDL_SetHint(SDL_HINT_RENDER_VSYNC, "1"); Also, set vertical sync to 'On' in my NVidia Control Panel.  but if you view the video below, it looks like there is some issue with the vertical redraw. Idk if this is an issue with VSync, with double buffering, or with something else.   Note in the video when I move the texture in view left to right, no issues are visible, but when i move forward and back, you see them clearly. The artifacts are much more noticable toward the top of the screen where the texels are taking up fewer pixels. Can anyone confirm that this looks like a VSync issue, or any ideas for what it might be? Much appreciated.
  8. gearifysoftware

    Simple point light fragment shader very slow

    I like that! I get way way better performance at 720p and I think 30hz should be very achievable.  I consider my issue solved. Very much appreciate the help!
  9. gearifysoftware

    Simple point light fragment shader very slow

    Thanks for the analysis. That's a relief that I can (at least partially) blame my hardware! I guess this calls into question whether or not I want to optimize for this machine or aim for a stronger graphics card. I am shooting for a game that doesn't have to be on a souped up gaming rig, but also doesn't need to run on a dinosaur... something mid range is what I'd like. I could potentially switch over to my other laptop, which has this card: https://www.techpowerup.com/gpudb/1490/geforce-gt-525m Could I expect much more out of this one? I see its production status is "End of Life'. Maybe its just time for a hardware upgrade... 
  10. gearifysoftware

    Simple point light fragment shader very slow

    I tried replacing the conditionals with the "max()" function. Marginal improvement, maybe 1 ms less frame time. Something, but doesn't quite give the full story I think. I double checked, but no, no Intel graphics hardware on this machine.  I did notice this  https://www.techpowerup.com/gpudb/2430/quadro-k1100m which states: "We recommend the NVIDIA Quadro K1100M for gaming with highest details at resolutions up to, and including, 1024x768." I am wondering if this card just can't handle those resolutions... still seems unacceptably slow
  11. I have a deferred rendering system, and I am testing at full 1920x1080 and noticing that a particular fragment shader is causing significant slowdown (they all seem oddly slow, but this one seems the most significant). My shader is based on the OGL-Dev tutorials for deferred rendering. The purpose of this shader is to calculate the added light within a light's area of effect. There are 3 large point lights in my scene, that cover everything in view. So essentially this shader is executing 3 times for every pixel on the screen. I measured the difference in frame time between running this shader, and then replacing the shader's main function with a simple "FragColor = vec4(1,0,0,1); //red". The total difference in time (for my engine to render an entire frame) is 4-5 milliseconds. If I'm shooting for 60 fps, that's already 25+% of my full frame render time, which seems kind of crazy (I removed shadow calculation and blur before taking these measurements). Here is my shader: #version 420 layout (location = 0) out vec4 FragColor; struct BaseLight { vec3 Color; float AmbientIntensity; float DiffuseIntensity; }; struct Attenuation { float Constant; float Linear; float Exp; }; struct PointLight { BaseLight Base; vec3 Position; Attenuation Atten; }; uniform sampler2D gPositionMap; uniform sampler2D gColorMap; uniform sampler2D gNormalMap; uniform sampler2D gShadowMap; uniform PointLight gPointLight; uniform vec3 gEyeWorldPos; uniform float gMatSpecularIntensity; uniform float gSpecularPower; uniform int gLightType; uniform vec2 gScreenSize; uniform mat4 gWVP; uniform mat4 gVP; uniform mat4 gView; vec4 CalcLightInternal(BaseLight Light, vec3 LightDirection, vec3 WorldPos, vec3 Normal, float shadowFactor ) { vec4 AmbientColor = vec4(Light.Color, 1.0f) * Light.AmbientIntensity; float DiffuseFactor = dot(Normal, -LightDirection); float shadowFactorOrig = shadowFactor; vec4 DiffuseColor = vec4(0, 0, 0, 0); vec4 SpecularColor = vec4(0, 0, 0, 0); if (DiffuseFactor > 0) { DiffuseColor = vec4(0,1,0,1); DiffuseColor = vec4(Light.Color, 1.0f) * DiffuseFactor ; vec3 VertexToEye = normalize(gEyeWorldPos - WorldPos); vec3 LightReflect = normalize(reflect(LightDirection, Normal)); float SpecularFactor = dot(VertexToEye, LightReflect); SpecularFactor = pow(SpecularFactor, gSpecularPower); if (SpecularFactor > 0) { SpecularColor = vec4(Light.Color, 1.0f) * gMatSpecularIntensity * SpecularFactor; } } return (AmbientColor + shadowFactor*(DiffuseColor+SpecularColor)); } vec4 CalcPointLight(vec3 WorldPos, vec3 Normal) { vec3 LightDirection = WorldPos - gPointLight.Position; float Distance = length(LightDirection); LightDirection = normalize(LightDirection); vec4 Color = CalcLightInternal(gPointLight.Base, LightDirection, WorldPos, Normal,1.0f); float Attenuation = gPointLight.Atten.Constant + gPointLight.Atten.Linear * Distance + gPointLight.Atten.Exp * Distance * Distance; Attenuation = min(1.0, Attenuation); return Color / Attenuation; } vec2 CalcTexCoord() { return gl_FragCoord.xy / gScreenSize; } void main() { vec2 TexCoord = CalcTexCoord(); vec3 WorldPos = texture(gPositionMap, TexCoord).xyz; vec3 Color = texture(gColorMap, TexCoord).xyz; vec3 Normal = texture(gNormalMap, TexCoord).xyz; Normal = normalize(Normal); FragColor = CalcPointLight(WorldPos, Normal); }  I am on a fairly fast HP machine with plenty of memory and a NVIDIA Quadro K1100M graphics card. Also, I already checked the VSync to make sure my render times are not forcing my render times to be multiples of 16ms.  This shader does not contain an inordinate amount of looping or branching. It is executing about 3 times per pixel. Should this really be adding 4-5 milliseconds to my render times?  Any ideas for what could be causing this would be much appreciated.  
  • 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!