Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


doesnotcompute

Member Since 16 Oct 2006
Offline Last Active Sep 05 2014 11:35 AM

#5099758 OpenGL Windows Question

Posted by doesnotcompute on 08 October 2013 - 06:51 PM

At a minimum on Window you should use GLEW. There are no system headers/libs for accessing modern OpenGL on Windows so you need to query every function at runtime using wglGetProcAddress. GLEW automates all of this, it queries all the function pointers your card supports and puts them in global function pointers so you can use it like a regular C API. It also provides a header with all the typedefs and constants you'll need to work with these functions.

 

It's worth pointing out that gDebugger is basically a legacy application now. It was purchased by AMD and has been integrated into their CodeXL profiler/debugger.




#5064320 ID3D11ShaderReflection struct field names

Posted by doesnotcompute on 23 May 2013 - 06:37 PM

I'm trying to use the ID3D11ShaderReflection API to basically dump all the constant information about my shaders: the location of every variable and every field in every structure. I'm iterating over each variable in each constant buffer, and when I encounter a variable of type D3D_SVC_STRUCT, I'm trying to iterate over each field. I cannot however seem to get the names of the struct fields. 

 

The type description for the struct itself will have a name like "material_t" (the name of the struct type), but the actual field types obtained with GetMemberTypeByIndex just have names like "float3" "float4" etc. I realize this follows the model established by the struct type name, but I was hoping to be able to get the actual field name as well so I can use the information I'm extracting to locate specific fields within the struct.

 

I'm trying to fit this inside an existing code base that expects to be able to set individual fields by name. Does anyone know of a way I can get this information with the reflection API? I realize I can get the disassembly and parse the field names out of there but that feels pretty clumsy when there is a (apparently almost functional) reflection API provided by Microsoft.

 

EDIT:

 

I should add, I looked at ID3D11ShaderReflectionType::GetMemberTypeName which takes an index and returns a name, and *sounds* like returns the information I want, however it seems to always return NULL on the shaders I've tested.

 

EDIT2:

 

Of course I was asking the field type itself for a member type name (and it has no members) I needed to ask the parent variable for the name! So this is resolved :D




#4898281 Per pixel point light: interpolating vertex world pos

Posted by doesnotcompute on 30 December 2011 - 05:06 PM

So it's the renormalization that introduces the "non-linearity" I guess. Because otherwise you could just distribute the dot product into that expression for 'N' and get the same result as in the per-vertex case.

Here are some screen shots from RenderMoneky showing per-vertex nDotL along with per-pixel with and without the renormalization

Per Vertex:

Posted Image.


Per Pixel w/out normalize

Posted Image

Per Pixel w/normalize

Posted Image


#4898255 Per pixel point light: interpolating vertex world pos

Posted by doesnotcompute on 30 December 2011 - 03:49 PM


I think you can make the same argument that the diffuse lighting calculation should be the same whether it's done per pixel or per vertex. In the per-vertex case you're computing the N*L dot product at the vertex and interpolating that to the each pixel. In the per pixel case you're interpolating the normal and computing the dot product per pixel but the dot product is a linear operation so it interpolates the same.

With specular lighting you have a non-linear term (a value raised to the specular exponent) which does not interpolate the same. Which is why vertex-lit meshes usually have weird looking specular highlights.


Definitely not. You're talking about the difference between vertex lighting and per-pixel lighting. Calculating NdotL at each vertex and interpolating the result is not the same as interpolating the normal and calculating NdotL at each pixel.

Think of a quad with vertex normals pointing away from the center, and a point light source directly above the center of the quad.


Yeah you're right (I just confirmed it RenderMonkey), I thought that seemed a little suspect as I was writing it. I don't quite see how it fails an interpolation calculation like the one I did above though.


#4898227 Per pixel point light: interpolating vertex world pos

Posted by doesnotcompute on 30 December 2011 - 01:55 PM

I think you can make the same argument that the diffuse lighting calculation should be the same whether it's done per pixel or per vertex. In the per-vertex case you're computing the N*L dot product at the vertex and interpolating that to the each pixel. In the per pixel case you're interpolating the normal and computing the dot product per pixel but the dot product is a linear operation so it interpolates the same.

With specular lighting you have a non-linear term (a value raised to the specular exponent) which does not interpolate the same. Which is why vertex-lit meshes usually have weird looking specular highlights.


#4898074 Per pixel point light: interpolating vertex world pos

Posted by doesnotcompute on 30 December 2011 - 01:17 AM


You will get the same results by interpolating the positing and then computing the light direction in the pixel shader...this is because vertex positions can be linearly interpolated. So you don't have anything to worry about.

I don't think you meant to say "same results", Matt. Interpolating the vertex positions and computing a light direction in the pixel shader will not give the same result as computing a light direction at each vertex and interpolating these vectors over the triangle. The former is correct while the latter is incorrect, in the sense of the resulting vector accurately pointing at the light source. You might say "similar results" in that interpolating the direction vectors isn't grossly inaccurate (for some definition of grossly).


Let's say we were interpolating along a line between points P1 and P2 rather than across a triangle (I'm a bit fuzzy on how to parameterize the triangle)

Let L0 = light position

The light direction at P1 is L1 = P1 - L0 and likewise L2 = P2 - L0.

The interpolated position at some intermediate point is P' = P1 + t * (P2 - P1) and the light position at this point is L' = P' - L0 = P1 + t * (P2 - P1) - L0

The interpolated light position at some point between P1 and P2 is L' = L1 + t * (L2 - L1) = P1 - L0 + t * (P2 - L0 - P1 + L0) = P1 + t * (P2 - P1) - L0, which is the same as the first result.

So they are the same right?


#4818444 DLLimport kernal32 in C#

Posted by doesnotcompute on 01 June 2011 - 04:40 PM

When I try to use:


[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("kernal32")]
private static extern bool QueryPerformanceFrequency(ref
            long PerformanceFrequency);

[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("kernal32")]
private static extern bool QueryPerformaceCounter(ref
            long PerformanceCount);


It throws me a System.dllNotFoundException in my game loop.

I tired to changing it to "kernal32.dll", but that didn't work. I tired a quick search to see if it had anything to do with the fact i'm running 64 bit win7, but I couldn't find anything on that. I have been able to get DLLimport to work in the past with other dll files, I am unsure why it isn't working with this dll.

Any help I can get is greatly appreciated.
LiquidWotter



Check your spelling (it's k-e-r-n-e-l not kernal).

EDIT:

Also, you can use the Stopwatch class in System.Diagnostics instead of pinvoking QueryPerformaceCounter.


#4816240 Header Files

Posted by doesnotcompute on 26 May 2011 - 05:55 PM

I see. What gamedev wants is damn right lazy people posting lazy questions that do not show they have tried to find the answer for themselves. I think you will find my answer to look in the standard is net etiquette for lazy bastards wanting information ie RTFM. To imply that I was rude or anything even close I find an insult, look again at my post it twice uses the word please and even requests that if the standard is not understood then ask another question.

I would like you to clarify where I was "Aggressive, combative, [or] rude " but never mind all is well, I do not need gamedev just as much as it seems the gamedev community does not want correct answers.


Bye!


#4790143 [.net] Reflector - no more free version

Posted by doesnotcompute on 24 March 2011 - 03:48 PM

Someone who lives in a country where 5$ american dollars is a small fortune either picked the wrong hobby, or needs to move to a better area.


Posted Image Because I'm sure for someone who lives in such a place, moving somewhere better is just that simple right? It's amazing they didn't think to do that without you pointing it out.

And on topic, I have no problem with them making future versions non-free, but retroactively killing the old free version is just messed up.


PARTNERS