• What Do You Need Help With? V8
    773 replies, posted
  • Avatar of Karmah
  • I think I've successfully switched over to metalness workflow for PBR materials. My lighting code in a nutshell: [code] vec3 radiance = lightColor * LightIntensity * NdotL; //multiply by attenuation, shadow factor, spot factor, etc... vec3 diffuse = albedo / PI; vec3 Fs = Fresnel_Shlick( mix(vec3(0.03), albedo, metalness), VdotH ); float D = NDF_GGX_TrowBridge_Reitz( NdotH_2, Alpha_2 ); float G = Geometry_Schlick_Beckmann( Alpha, NdotL, NdotV ); vec3 specular = (Fs * D * G) / (4.0 * NdotL * NdotV + EPSILON); float ratio = (vec3(1.0f) - Fs) * (1.0 - Metalness); vec3 Direct_Lighting = ratio * diffuse + specular * radiance; [/code] However some dot products get clamped. The 3 functions I reference here are just straight up calculations pulled from that blog I cited in my last post. A question regarding gamma correction: I gamma correct my albedo textures in my geometry pass by raising them to the power of 2.2. At the very end of my rendering pass, I gamma correct the final image by raising it to the power of (1 / user_gamma). Even though I end up applying the user's desired gamma correction at the end, at any point should I gamma correct again to revert [I]back[/I] into sRGB (1 / 2.2)?
  • [QUOTE=Karmah;52441985]I think I've successfully switched over to metalness workflow for PBR materials. My lighting code in a nutshell: [code] vec3 radiance = lightColor * LightIntensity * NdotL; //multiply by attenuation, shadow factor, spot factor, etc... vec3 diffuse = albedo / PI; vec3 Fs = Fresnel_Shlick( mix(vec3(0.03), albedo, metalness), VdotH ); float D = NDF_GGX_TrowBridge_Reitz( NdotH_2, Alpha_2 ); float G = Geometry_Schlick_Beckmann( Alpha, NdotL, NdotV ); vec3 specular = (Fs * D * G) / (4.0 * NdotL * NdotV + EPSILON); float ratio = (vec3(1.0f) - Fs) * (1.0 - Metalness); vec3 Direct_Lighting = ratio * diffuse + specular * radiance; [/code] However some dot products get clamped. The 3 functions I reference here are just straight up calculations pulled from that blog I cited in my last post. A question regarding gamma correction: I gamma correct my albedo textures in my geometry pass by raising them to the power of 2.2. At the very end of my rendering pass, I gamma correct the final image by raising it to the power of (1 / user_gamma). Even though I end up applying the user's desired gamma correction at the end, at any point should I gamma correct again to revert [I]back[/I] into sRGB (1 / 2.2)?[/QUOTE] Yeah that looks about right to me, that's pretty much what I did last time I implemented a PBR pipeline if I'm not mistaken.
  • Avatar of Foda
  • [QUOTE=jung3o;52427059]hey guys, so i really want something like the windows media player thing on the task bar for spotify (I'm using windows 10) [t]http://media.askvg.com/articles/images/WMP12_Mini_Taskbar_Toolbar_Taskband.png[/t] and couldn't find anything like that. Can someone give me like little guidance to where i can start from? So I've never made a program before for windows and don't really know where I should be starting. I've never really touched with c# before... and with c++, only used for school assignments with pre-added in codes. So i got visual studio 2015, is there something extra I would need for something like this? Would using spotify's web api be okay with this? I'd be running spotify desktop app on the side. I don't see anything about a desktop hook... I got lots of time in my hands right now, so starting off with something smaller wouldn't bother me at all... Don't know what I should be looking at though.[/QUOTE] you won't be able to do anything other than control playback, and you'll need the spotify app running to have music playing (spotify doesn't allow playback outside the app, so if you really want to do that you'll need a web-view). if you're using c# (which will make most of this easy...): * Use [URL="https://github.com/paulcbetts/refit"]Refit[/URL] to define the Spotify API * You'll want to use the Deskband API -- which is a [URL="https://msdn.microsoft.com/en-us/library/windows/desktop/cc144099(v=vs.85).aspx"]complete pain in the ass [/URL]to use. Specifically, you'll need to use the "IDeskband2" interface in Win7+. Keep in mind that MS doesn't recommend using Deskbands anymore, but that's up to you.
  • Avatar of Karmah
  • I'm working on implementing Parallax Occlusion mapping. So far I've gotten some pretty nice results (as long as the height scale is low), but I'm not entire sure if my results are completely correct. I know that at grazing angles the naive parallax mapping effect breaks, but other tweaks exist to minimize those errors. My question is this: is it normal for the perceived depth into a parallax mapped surface to stretch and scale depending on the viewing angle? Like, the effect works pretty good, but when I start looking at it at a shallow angle the depth into the map seems to drop: [t]http://i.imgur.com/1QogcDY.png[/t][t]http://i.imgur.com/upkpvxG.png[/t] I'm doing this effect during my gbuffer filling pass, and modify the incoming texture coordinates as so: [code] const vec3 ViewTangentEyePos = mat3(InvVMatrix) * ViewTBN * EyePosition.xyz; // ViewTBN is the viewspace Tangent,Bitangent,Normal (TBN) matrix const vec3 ViewTangentFragPos = mat3(InvVMatrix) * ViewTBN * m_vertex.xyz; const vec3 View_Dir = normalize(ViewTangentEyePos - (mMatrix * vec4(vertex,1.0))); const float View_Angle = abs(dot(vec3(0.0, 0.0, 1.0), View_Dir)); const float minLayers = 8.0; const float maxLayers = 32.0; const float numLayers = mix(maxLayers, minLayers, View_Angle); const float layerDepth = 1.0f / numLayers; const vec2 P = View_Dir.xy * height_scale; const vec2 deltaTexCoords = P / numLayers; vec2 currentTexCoords = TexCoord0; float currentDepthMapValue = 1.0f - texture(MaterialMap, vec3(currentTexCoords, 1)).a; // Height stored in alpha channel float currentLayerDepth = 0.0; while(currentLayerDepth < currentDepthMapValue) { currentTexCoords -= deltaTexCoords; currentDepthMapValue = 1.0f - texture(MaterialMap, vec3(currentTexCoords, 1)).a; currentLayerDepth += layerDepth; } const vec2 prevTexCoords = currentTexCoords + deltaTexCoords; const float afterDepth = currentDepthMapValue - currentLayerDepth; const float beforeDepth = 1.0f - texture(MaterialMap, vec3(prevTexCoords, 1)).a - currentLayerDepth + layerDepth; const float weight = afterDepth / (afterDepth - beforeDepth); const vec2 Parallax_TexCoord = prevTexCoords * weight + currentTexCoords * (1.0 - weight); [/code] Edited: Fixed, I needed to divide View_Dir.xy by its Z component in vec2 P, so it now reads: [code]const vec2 P = View_Dir.xy / View_Dir.z * height_scale; [/code]
  • Avatar of Karmah
  • I'm trying to generate per-vertex normals for my terrain. To aid with this, I've built a struct which for each vertex tracks information about all the faces that vertex comes into contact with. So to calculate the per-vertex normals, I added up all the normals of each face the vertex is a part off, and normalize. Is this same approach valid for tangents and bitangents? [code] // Vertex_Adjacency holds reference to all the triangles that surrounds a vertex for each (const Vertex_Adjacency &vertex in vertex_adj) { vec3 vertex_normal(0), vertex_tangent(0), vertex_bitangent(0); for each (Triangle *triangle in vertex.triangles) { // All its neighbors vertex_normal += triangle->normal; vertex_tangent += triangle->tangent; vertex_bitangent += triangle->bitangent; } vertex_tangent = vertex_tangent - vertex_normal * glm::dot(vertex_normal, vertex_tangent); normals.push_back(glm::normalize(vertex_normal)); tangents.push_back(glm::normalize(vertex_tangent)); bitangents.push_back(glm::normalize(vertex_bitangent)); }[/code] This shouldn't be a problem, right? I mean, since we are using the same faces for the normals, tangents, and bitangents, then the average tangent and average bitangent should be orthogonal to the average normal?
  • Do any of you know any [B]entry level books[/B] on [B]Kotlin[/B] and/or [B]Android app development[/B]? I haven't touched Java in years and never made anything for Android, so I'm more or less starting from very little knowledge here. Going through a relatively verbose but consistent introduction once is going to be faster for me than figuring out which standalone tutorials to use for each basic platform concept I don't know.
  • [QUOTE=Tamschi;52455786]Do any of you know any [B]entry level books[/B] on [B]Kotlin[/B] and/or [B]Android app development[/B]? I haven't touched Java in years and never made anything for Android, so I'm more or less starting from very little knowledge here. Going through a relatively verbose but consistent introduction once is going to be faster for me than figuring out which standalone tutorials to use for each basic platform concept I don't know.[/QUOTE] [url]https://commonsware.com/Android/[/url] this book is a constantly updated E-Book. I was using it for work; solid enough!
  • Avatar of Agenda21Dev
  • I'm trying to texture some models in 3DSMax, is there any tool or scripts I can use to hasten the process? Unwrapping UV's seems like a real nightmare.
  • C noob here, just going through some basics: [CODE]int main() { float fahr, celsius; float lower, upper, step; lower = 0.0; // Lower limit of temperature scale upper = 300.0; // Upper limit step = 20.0; // Step size fahr = lower; while (fahr <= upper){ celsius = (5.0/9.0) * (fahr-32.0); printf("%3.0f\t%1.0f\n", fahr, celsius); fahr = fahr + step; } }[/CODE] "The printf conversion specification %3.0f says that a floating-point number (here fahr) is to be printed at least three characters wide, with no decimal point and no fraction digits. %6.1f describes another number (celsius) that is to be printed at least six characters wide, with 1 digit after the decimal point." What do they mean by "three characters wide" or "six characters wide"? If I change %3.0f to %2.0f it doesn't make the numbers like 101 or 201 any shorter? They are still 101 and 201
  • Avatar of WTF Nuke
  • 3 characters wide means 3 characters, that is to say "abcdef" is 6 chars wide, a character being an alphanumeric. So if you wanted to print 20 with %3.0f it would print " 20" (note the space at the front). However, since 101/201 are already longer or equal to three characters it doesn't have an affect. Try doing %6.0f instead to better illustrate what I mean.
  • [url]https://www.cloudindexuk.com/home[/url] Suggestions for design and layout? It's running on a demo account for the domain itself.
  • Avatar of Adelle Zhu
  • I'm still working on my laboratory software and I finally finished the label printing feature. However, when I press the print label button, it prints a label for the order that is open in the window as well as every order that I viewed before it. I'm getting the feeling that it has something to do with the order object (a parameter to the print label function) not being destroyed properly after the order info window is closed. Does anyone have any ideas
  • [QUOTE=WTF Nuke;52463709]3 characters wide means 3 characters, that is to say "abcdef" is 6 chars wide, a character being an alphanumeric. So if you wanted to print 20 with %3.0f it would print " 20" (note the space at the front). However, since 101/201 are already longer or equal to three characters it doesn't have an affect. Try doing %6.0f instead to better illustrate what I mean.[/QUOTE] So if I understand you correct, changing the number can extend the character length with spaces but not truncate it to a shorter length than it already is?
  • Avatar of WTF Nuke
  • More or less, yep. If you want to truncate the length you can use something like a modulo. You can also extend the length with leading 0s instead of spaces by adding a 0 before the length, such as %03.0f.
  • I've stumbled upon a website with insanely low rate limits while trying to write a parser for it. Does anybody know easiest (and cheapest) way to get around those limits? I'm far from putting a huge load on the server but I still trigger those limits and they are progressive so it's even worse each time I trigger it. The app is designed to automatically run every hour so I need a method which doesn't require babysitting.
  • [QUOTE=Megalan;52472814]I've stumbled upon a website with insanely low rate limits while trying to write a parser for it. Does anybody know easiest (and cheapest) way to get around those limits? I'm far from putting a huge load on the server but I still trigger those limits and they are progressive so it's even worse each time I trigger it. The app is designed to automatically run every hour so I need a method which doesn't require babysitting.[/QUOTE] Can you stagger the requests over a longer time period?
  • [QUOTE=Tamschi;52477100]Can you stagger the requests over a longer time period?[/QUOTE] I'm already following website's guidelines which say something like "make 1 minute pause if you get over the rate limit. Make your pause 1 minute longer each time you get rate limit error". After a while even after reaching pause time of ~5 minutes I'm getting rate limit error just after sending 5 requests because their progressive rate limit does not reset unless you don't make requests for like an hour. ~50 requests per hour is a complete bullshit. Right now the only idea I have is VPN but I have no idea which VPN service has stable connection and random ip's for each new session.
  • Avatar of Mechanical43
  • I'm trying to setup a nice Unix c++ workflow for myself but I find it really hard to get to something I could use day in day out. I think VS spoiled me. edit: a question for you guys, what does your workflow looks like ?
  • [QUOTE=Mechanical43;52479004]I'm trying to setup a nice Unix c++ workflow for myself but I find it really hard to get to something I could use day in day out. I think VS spoiled me. edit: a question for you guys, what does your workflow looks like ?[/QUOTE] My linux workflow is - write the thing on Windows - push to git repo - pull on linux machine - gcc that shit on the command line - fix the 150 lines of template errors using vim or whatever I find that can edit text - optionally if it's a project that involves hardware rendering, fix all OpenGL/Vulkan runtime errors - push the fixed thing - fix windows build Uhm yeah so I guess same question, can someone recommend a *healthy* linux workflow?
  • Avatar of tschumann
  • [QUOTE=JWki;52480699]My linux workflow is - write the thing on Windows - push to git repo - pull on linux machine - gcc that shit on the command line - fix the 150 lines of template errors using vim or whatever I find that can edit text - optionally if it's a project that involves hardware rendering, fix all OpenGL/Vulkan runtime errors - push the fixed thing - fix windows build Uhm yeah so I guess same question, can someone recommend a *healthy* linux workflow?[/QUOTE] Me too although a lot of what I do is Half-Life/Source modding so it generally compiles without too much issue when I pull on Linux. I use PHPStorm for work and it's pretty good - I imagine CLion is too but I've never got around to trying it. I don't really like CMake either.
  • Avatar of gokiyono
  • [QUOTE=Mechanical43;52479004]I'm trying to setup a nice Unix c++ workflow for myself but I find it really hard to get to something I could use day in day out. I think VS spoiled me. edit: a question for you guys, what does your workflow looks like ?[/QUOTE] I usually just do webdev, but I thibk using makefiles would be a help. And then setting up your favourite editor to make that when a hot key is pressed Or you could go the simple route and use something like NetBeans
  • Avatar of WTF Nuke
  • I use the bash for linux subsystem to check if the linux code works well, so I just try to compile, fix template errors x2, run tests and call it a day.
  • Avatar of joshthesmith
  • [url=http://www.a9cleaning.co.uk/laundryandcleaning/]Need help getting twitter feed to stick to the bottom of the screen and be able to scroll up and down, just like the arrow which brings you to the top - right hand side)[/url] Literally no idea how to do it, stuck here. Can anyone provide insight?
  • [QUOTE=joshthesmith;52481797][url=http://www.a9cleaning.co.uk/laundryandcleaning/]Need help getting twitter feed to stick to the bottom of the screen and be able to scroll up and down, just like the arrow which brings you to the top - right hand side)[/url] Literally no idea how to do it, stuck here. Can anyone provide insight?[/QUOTE] [code]position: fixed[/code]
  • Avatar of joshthesmith
  • [QUOTE=proboardslol;52483421][code]position: fixed[/code][/QUOTE] Thank you! [sp]Been at this too long :v:[/sp]
  • Avatar of blacksam
  • Anyone know a painless way to port 2d unity game to android without having to rewrite controls? I have a simple pong game I wrote for a class and I don't want to rewrite using touch events since I've already mapped everything to W & S and up &down for 2 players.
  • Avatar of Thelurker1234
  • Would it be bad to go through a 1993 c++ book I have? Specifically lippmanns c++ primer 2nd ed. I'm pretty new to programming and I made that fuckup of not checking the edition when ordering it. I know there's been quite a lot of changes like smart pointers so maybe it won't be?
  • Avatar of WTF Nuke
  • Probably not the best idea, the way you do modern C++ is quite substantially different than pre 2011 C++ (no explicit new/delete as an example).
  • Avatar of Thelurker1234
  • Getting the new version then. Thank you. I'll probably still keep this somewhere since I do enjoy history, it might be neat eventually to take a look at how things were done differently at that time.
  • Avatar of daigennki
  • Trying to make a dialogue box with running (if that is the right word) text, the kind you see in RPGs and such. I put this code together: [code]//Dialogue box class DialogueBox : public GUIElement { private: GUIText textElement[2]; std::wstring dispText; std::wstring lines[2]; std::wstring lastText; public: std::wstring text; //draw the box void draw(float delta) { calcOutlineRect(); //Background box glColor3f(1.0f, 1.0f, 0.8f); glBegin(GL_POLYGON); glVertex2i(outlineRect.x, outlineRect.y); glVertex2i(outlineRect.x + outlineRect.w, outlineRect.y); glVertex2i(outlineRect.x + outlineRect.w, outlineRect.y + outlineRect.h); glVertex2i(outlineRect.x, outlineRect.y + outlineRect.h); glEnd(); //Outline glLineWidth(2.0f); glColor3f(0.2f, 0.4f, 0.8f); glBegin(GL_LINE_LOOP); glVertex2i(outlineRect.x, outlineRect.y); glVertex2i(outlineRect.x + outlineRect.w, outlineRect.y); glVertex2i(outlineRect.x + outlineRect.w, outlineRect.y + outlineRect.h); glVertex2i(outlineRect.x, outlineRect.y + outlineRect.h); glEnd(); //draw text if (lastText != text) dispText = L""; lastText = text; if (dispText != text) { dispText += text.at(dispText.length()); int newlinePos = dispText.find_first_of(L"\n"); if (newlinePos != -1) { lines[1] = dispText.substr(0, newlinePos - 1); lines[2] = dispText.substr(newlinePos + 1); } else { lines[1] = dispText; lines[2] = L""; } } for (int i = 1; i <= 2; i++) { if (lines[i] != L"") { textElement[i].x = outlineRect.x + 8; textElement[i].y = outlineRect.y + 8 + 32 * i - 32; textElement[i].text = lines[i]; textElement[i].fontFile = "ipaexg.ttf"; textElement[i].size = 32; textElement[i].fgcolor = { 0, 0, 0 }; textElement[i].draw(); } } } };[/code] Gave it text of "The quick brown fox jumps\nover the lazy dog.", but I only got "T" and it stops there. :v: [img]http://i.imgur.com/rBRQjhS.png[/img] Any ideas what I might be doing wrong? [editline]20th July 2017[/editline] Found the cause, looks like dispText kept on getting reset every frame for some reason. Moved "lastText = text" to the end of the function, works now.