Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
ZombieApostate
Mar 13, 2011
Sorry, I didn't read your post.

I'm too busy replying to what I wish you said

:allears:

Hubis posted:

Well what matrix were you multiplying them by?

If you've got vertex normals, they're in the model-space of the object your rendering. To get them in world-space (which you'd want for doing lighting, etc) you have to transform them by. Normals are different than points, so to transform from space A to space B, you'd use the inverse-transpose of the A-to-B transform matrix.

The other alternative is to keep your vertex normals in model space, and transform your lights into the space for that object instead. That is basically a question of code organization and how your pipelines are optimized: is it a forward or deferred renderer? What is your Vertex-per-Object ratio? Are you using normal maps (and so need to transform binormals/tangents as well)? How many lights per object are you using? For a simple engine, it probably doesn't matter too much.

For now I'm putting my vertices into world space, not doing deferred rendering (may in the future after more research), haven't gotten to normal maps yet, only working with one light but will want more.

Thinking about it now, I'm guessing my shading only looks correct now because I haven't rotated any of my objects in any of my tests. So I need to transform the normals with the inverse transpose of the view projection matrix, then? I think I mucked that up and used the wrong one or changed it to the wrong one when it wasn't working initially and never changed it back. Current shader below. Wishing we had collapsible code blocks so I didn't feel like I was spamming a bunch of text into the thread.

Note:
worldViewProjMatrix = projection * view * objectWorldTransform
worldMatrix = objectWorldTransform

Vertex Shader:
code:
output main(input IN)
{
	output OUT = output(0);
	OUT.position = mul(IN.worldViewProjMatrix, IN.position);

	OUT.texCoord = IN.texCoord;

	OUT.light = IN.lightDir.xyz;

	float3 posWorld = normalize(mul(IN.worldMatrix, IN.position));
	OUT.view = IN.eye - posWorld;

	//Every example I've seen wants you to transform the normal.  For some reason all it does is gently caress everything up when I do it.  Works fine without, though.
	OUT.normal = normalize(IN.normal).xyz;

	return OUT;
}
Fragment Shader:
code:
float4 main(input IN) : COLOR
{
	float4 color = tex2D(IN.colorMapSampler, IN.texCoord);
	float3 normal = normalize(IN.normal);
	float3 lightDir = normalize(IN.light);
	float3 viewDir = normalize(IN.view);
	float3 diff = saturate(dot(normal, lightDir));

	float3 reflect = normalize(2 * diff * normal - lightDir);
	float3 specular = pow(saturate(dot(reflect, viewDir)), IN.shininess.r);

	float4 result;
	result = float4(color.rgb * (IN.ambient.rgb + IN.diffuse.rgb * diff) + IN.specular.rgb * specular, 1.0f);
	//result.w = 1.0f;
	return result;
}

Adbot
ADBOT LOVES YOU

Hubis
May 18, 2003

Boy, I wish we had one of those doomsday machines...

ZombieApostate posted:

For now I'm putting my vertices into world space, not doing deferred rendering (may in the future after more research), haven't gotten to normal maps yet, only working with one light but will want more.

Thinking about it now, I'm guessing my shading only looks correct now because I haven't rotated any of my objects in any of my tests. So I need to transform the normals with the inverse transpose of the view projection matrix, then? I think I mucked that up and used the wrong one or changed it to the wrong one when it wasn't working initially and never changed it back. Current shader below. Wishing we had collapsible code blocks so I didn't feel like I was spamming a bunch of text into the thread.

Note:
worldViewProjMatrix = projection * view * objectWorldTransform
worldMatrix = objectWorldTransform

Vertex Shader:
code:
output main(input IN)
{
	output OUT = output(0);
	OUT.position = mul(IN.worldViewProjMatrix, IN.position);

	OUT.texCoord = IN.texCoord;

	OUT.light = IN.lightDir.xyz;

	float3 posWorld = normalize(mul(IN.worldMatrix, IN.position));
	OUT.view = IN.eye - posWorld;

	//Every example I've seen wants you to transform the normal.  For some reason all it does is gently caress everything up when I do it.  Works fine without, though.
	OUT.normal = normalize(IN.normal).xyz;

	return OUT;
}
Fragment Shader:
code:
float4 main(input IN) : COLOR
{
	float4 color = tex2D(IN.colorMapSampler, IN.texCoord);
	float3 normal = normalize(IN.normal);
	float3 lightDir = normalize(IN.light);
	float3 viewDir = normalize(IN.view);
	float3 diff = saturate(dot(normal, lightDir));

	float3 reflect = normalize(2 * diff * normal - lightDir);
	float3 specular = pow(saturate(dot(reflect, viewDir)), IN.shininess.r);

	float4 result;
	result = float4(color.rgb * (IN.ambient.rgb + IN.diffuse.rgb * diff) + IN.specular.rgb * specular, 1.0f);
	//result.w = 1.0f;
	return result;
}

No, not the view projection -- that would put the normals into camera space. You just want to use the inverse-transpose of the model transform. But yeah, since translation doesn't affect normals (W coordinate for vectors is 0!) only rotation would show a difference.

ZombieApostate
Mar 13, 2011
Sorry, I didn't read your post.

I'm too busy replying to what I wish you said

:allears:

Hubis posted:

No, not the view projection -- that would put the normals into camera space. You just want to use the inverse-transpose of the model transform. But yeah, since translation doesn't affect normals (W coordinate for vectors is 0!) only rotation would show a difference.

:derp: Yeah, I was just rolling it around in my head again and thought the model transform made more sense than the view projection. Thanks for the help, I've been working on this too much lately. I'm learning a ton, but I think my brain is starting to fry. Always nice to have somebody to bounce problems off of.

unSavory
Sep 26, 2004
fellow
I've just finished designing and have just started programming a music-based FPS in UDK. The gameplay in a nutshell, is that all your enemies make neat noises. When you kill them or "freeze" them with your super cool future weapon, those sounds become a part of the soundtrack. All of this will be dynamic, so killing things in different orders and with different weapons will end up with different sounds and things being added to the mix, giving the player control over both the player and the music pumping through their headphones. On top of that, the players movements will control the underlying beat. Running, crouching, jumping and shooting will all change the sound drastically.

It's gonna be super fuckin' cool.

But... as of this moment (after three days of sleepless programming and problem solving) all I've managed to make is this. Syncing audio through the unreal engine is not exactly the easy task I thought it was going to be.

http://www.youtube.com/watch?v=my5fEkpThNM

seiken
Feb 7, 2005

hah ha ha

unSavory posted:

I've just finished designing and have just started programming a music-based FPS in UDK. The gameplay in a nutshell, is that all your enemies make neat noises. When you kill them or "freeze" them with your super cool future weapon, those sounds become a part of the soundtrack. All of this will be dynamic, so killing things in different orders and with different weapons will end up with different sounds and things being added to the mix, giving the player control over both the player and the music pumping through their headphones. On top of that, the players movements will control the underlying beat. Running, crouching, jumping and shooting will all change the sound drastically.

It's gonna be super fuckin' cool.

Please finish this and make it as good as you promise, I'd never play anything else

unSavory
Sep 26, 2004
fellow
That is the plan. :clint: I'm glad some one that isn't me thinks it's a rad idea.

I've got a couple of dudes working with me on art and visuals that really know their stuff, and the music and sound design is being done by me and my roommate who make up Dramaticat, so I'm pretty positive it's gonna be awesome as long as I can keep up my end with the gameplay.

Here's an update just from the last hour or so. Demoing a slow-mo effect when the player ducks.

http://www.youtube.com/watch?v=RWiu1T4h1vY

I'm thinking about setting up a blog to document the whole process, really just for my own benefit. This is my first foray into serious game development so it'd be nice if I gently caress something up to be able to click back a few entries and figure out where something went wrong. I'll post a link up if I get around to it.

VVV Haha for serious. Those are just a couple cheesy loops I picked out for testing.

unSavory fucked around with this message at 20:47 on Aug 29, 2011

Vino
Aug 11, 2010
Dear SA, today I learned that half-speed trance music is the poo poo.

Anyhow you need higher quality source music so that when it goes half speed it doesn't sound so aliased.

Physical
Sep 26, 2007

by T. Finninho
Try listening to ripping fast solos at half speed. Fast music slowed down is always cool.

Do each of those cubes add a different layer to the audio based on proximity? Thats p cool, I had a similar idea but haven't gotten to it yet. I hope you guys do well.

unSavory
Sep 26, 2004
fellow
Yeah they do. As things progress it'll be the bad guys doing that.

Physical
Sep 26, 2007

by T. Finninho
I'm also jelly that you have like 5 buddies working on it with you. All my friends are bums who talk about ideas but never want to sit down, plan, an execute :(

Shalinor
Jun 10, 2002

Can I buy you a rootbeer?

Physical posted:

I'm also jelly that you have like 5 buddies working on it with you. All my friends are bums who talk about ideas but never want to sit down, plan, an execute :(
Finding a team that won't flake out is easily the hardest part of indie dev. Your best bet is to sit down, figure out precisely what game you could make with no help whatsoever, and make that... and as people want to help, give them tasks to prove them out, and watch them disappear, until you find a solid core that sticks.

Next, finish that one-man project with some help, and THEN you can make your (team's) magnum opus.

Physical
Sep 26, 2007

by T. Finninho

Shalinor posted:

Finding a team that won't flake out is easily the hardest part of indie dev. Your best bet is to sit down, figure out precisely what game you could make with no help whatsoever, and make that... and as people want to help, give them tasks to prove them out, and watch them disappear, until you find a solid core that sticks.

Next, finish that one-man project with some help, and THEN you can make your (team's) magnum opus.

That is actually the exact thing I have realized (for a long time). No pre-dev recruiting via message boards cuz no one will give a poo poo about my project until it's something they can see a youtube video of and play. And I can't blame them. As cool as previous guys project is and as badly as I would like to contribute, I don't want to get involved because it's so new or something. I also don't want to share my lovely code with anyone just yet haha.

I actually had a great phone call with some west coast guys yesterday that may want to toss some money at my project (as I have already worked on one of theirs [AND THEY PAID ME!]) So now it helps give me some deadlines to work around which is great because I find it hard to slave drive myself. I wish I could say who it was but I signed documents that said I couldn't but it is really exciting for me because the guy has previously made a hit game in a genre that I will not divulge :)

unSavory
Sep 26, 2004
fellow
Allow me to ambiguously congratulate you on your unspecific endeavor that I won't name.

Fake Edit: No really, that's awesome.

Toadsoup
Apr 10, 2004
I'm the god-damn govenor's son
A friend and I were discussing making a game, but as neither of us are good enough developers we decided to outsource a programmer. We still did the artwork, website, and managed the whole operation, but he was in charge of programming the whole thing.

It worked out fairly well and most importantly we found an awesome developer to work with on more complex games later on.

From the process I have learned a ton about game dev. Plus I'll be able to go through the source and really get an understand.

It is an Android game called Duck Carnage. It is like a hardcore version of a certain NES game featuring ducks. You can use a shotgun, machine gun, and grenades.

We just released a free version and a paid version this last week. - http://www.duckcarnage.com

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!

Physical posted:

As cool as previous guys project is and as badly as I would like to contribute, I don't want to get involved because it's so new or something.
It's not just that, it's that there are a loving billion of "I've got an idea for a game" types that haven't put down an ounce of effort. Most indie projects fail, and the only sign of a project with the potential to not fail is that it's made progress.

Vino
Aug 11, 2010
I need a tool that can do animation as simply and intuitively as Silo does modeling. Please don't say Blender. I don't mind paying for one as long as it's not inordinately expensive. Any suggestions?

Physical
Sep 26, 2007

by T. Finninho

OneEightHundred posted:

It's not just that, it's that there are a loving billion of "I've got an idea for a game" types that haven't put down an ounce of effort. Most indie projects fail, and the only sign of a project with the potential to not fail is that it's made progress.
Also there are a billion "I wanna help too" from schmucks that also go "can you teach me how to program? Is it like <insert lovely non-compiled language here>?" He doesn't know me from Adam, and projects get alot of "I wanna help too" emails that get rejected. I emailed notch one time asking if I could help port to xbox. I was serious about it and have the chops to get it done, but of course he probably read that and laughed at how much of a schmuck he perceived me as being.

Physical fucked around with this message at 03:10 on Aug 30, 2011

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Physical posted:

I emailed notch one time asking if I could help port to xbox. I was serious about it and have the chops to get it done, but of course he probably read that and laughed at how much of a schmuck he perceived me as being.

I was curious about the technical challenges in that. Isn't Minecraft in Java? Is there even a JVM for xbox?

Physical
Sep 26, 2007

by T. Finninho

Rocko Bonaparte posted:

I was curious about the technical challenges in that. Isn't Minecraft in Java? Is there even a JVM for xbox?
Nah... well maybe. I don't know what kind of stuff Microsoft would hook Mojang up with. But I essentially was going to rewrite the Java into C# XNA (which is what their base game came from in the frist place!)

Physical
Sep 26, 2007

by T. Finninho
Also C# = Java + .Net (to me anyway.) Thats the first thing I thought of when I started C# 2 years ago. I programmed in Java for a college class in like 2006 and hadn't touched it since. Then I started with C# and was like "holy poo poo a better name for this would be MSJava."

Physical
Sep 26, 2007

by T. Finninho
gently caress I just spent the last hour figuring out why my poo poo wasn't appearing where it should and messing with the same block of code thinking that I had the math messed up. Turns out I loving COMMENTED OUT SOME VERY IMPORTANT CODE IN ANOTHER FILE while I got the first file's math figured out. gently caress man. I hate when I waste time like that.

Hughlander
May 11, 2005

Physical posted:

Also C# = Java + .Net (to me anyway.) Thats the first thing I thought of when I started C# 2 years ago. I programmed in Java for a college class in like 2006 and hadn't touched it since. Then I started with C# and was like "holy poo poo a better name for this would be MSJava."

From http://james-iry.blogspot.com/2009/05/brief-incomplete-and-mostly-wrong.html

1996 - James Gosling invents Java. Java is a relatively verbose, garbage collected, class based, statically typed, single dispatch, object oriented language with single implementation inheritance and multiple interface inheritance. Sun loudly heralds Java's novelty.

2001 - Anders Hejlsberg invents C#. C# is a relatively verbose, garbage collected, class based, statically typed, single dispatch, object oriented language with single implementation inheritance and multiple interface inheritance. Microsoft loudly heralds C#'s novelty.

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!
C# was "invented" after Microsoft was told they couldn't call their non-compliant Java implementation Java.

It pretty much IS Java, except markedly less stupid about custom data types, generics, containers, and property access.

roomforthetuna
Mar 22, 2005

I don't need to know anything about virii! My CUSTOM PROGRAM keeps me protected! It's not like they'll try to come in through the Internet or something!

OneEightHundred posted:

It pretty much IS Java, except markedly less stupid about custom data types, generics, containers, and property access.
Plus not cross-platform, which is both a blessing [more system powers available] and a curse [people like not having to make the same thing a bunch of times].

Edit: not that you can't get at system powers with Java, but to do so ruins the whole point.

Vinterstum
Jul 30, 2003

roomforthetuna posted:

Plus not cross-platform, which is both a blessing [more system powers available] and a curse [people like not having to make the same thing a bunch of times].

Edit: not that you can't get at system powers with Java, but to do so ruins the whole point.

I'm not sure how meaningful Java's cross-platform-ness is these days, really. It's not like we're drowning in Win/OSX/Linux cross-platform Java apps on the desktop, and in the enterprise market you're developing for a specific platform anyway. Minecraft is pretty much the only game I can think of that I've played recently which has been multi-platform due to Java. For a game, you're just as cross-platform in C++ as long as you pick the right libraries to use. Or even more so, due to iOS/XBox/PS3.

Hughlander
May 11, 2005

Vinterstum posted:

I'm not sure how meaningful Java's cross-platform-ness is these days, really. It's not like we're drowning in Win/OSX/Linux cross-platform Java apps on the desktop, and in the enterprise market you're developing for a specific platform anyway. Minecraft is pretty much the only game I can think of that I've played recently which has been multi-platform due to Java. For a game, you're just as cross-platform in C++ as long as you pick the right libraries to use. Or even more so, due to iOS/XBox/PS3.

libgdx for android/desktop development is fairly meaningful to me.

roomforthetuna
Mar 22, 2005

I don't need to know anything about virii! My CUSTOM PROGRAM keeps me protected! It's not like they'll try to come in through the Internet or something!

Vinterstum posted:

For a game, you're just as cross-platform in C++
... but not in C#, no matter what libraries you pick.

Paniolo
Oct 9, 2007

Heads will roll.
For game dev purposes, C# supports more relevant platforms than Java- iOS, Android, Xbox, plus all relevant consumer desktop platforms. Of those Java only runs on desktops and Android, afaik.

Physical
Sep 26, 2007

by T. Finninho

Hughlander posted:

From http://james-iry.blogspot.com/2009/05/brief-incomplete-and-mostly-wrong.html

1996 - James Gosling invents Java. Java is a relatively verbose, garbage collected, class based, statically typed, single dispatch, object oriented language with single implementation inheritance and multiple interface inheritance. Sun loudly heralds Java's novelty.

2001 - Anders Hejlsberg invents C#. C# is a relatively verbose, garbage collected, class based, statically typed, single dispatch, object oriented language with single implementation inheritance and multiple interface inheritance. Microsoft loudly heralds C#'s novelty.

OneEightHundred posted:

C# was "invented" after Microsoft was told they couldn't call their non-compliant Java implementation Java.

It pretty much IS Java, except markedly less stupid about custom data types, generics, containers, and property access.

My god. My ability to independently see through the bullshit is at superhuman strength.

Hughlander
May 11, 2005

Physical posted:

My god. My ability to independently see through the bullshit is at superhuman strength.

You realize of course the link you quoted was humor right? Particularly since it starts with:
1801 - Joseph Marie Jacquard uses punch cards to instruct a loom to weave "hello, world" into a tapestry. Redditers of the time are not impressed due to the lack of tail call recursion, concurrency, or proper capitalization.

Unless of course you thought reddit was around in 1801 :)

Vino
Aug 11, 2010

Vino posted:

I need a tool that can do animation as simply and intuitively as Silo does modeling. Please don't say Blender. I don't mind paying for one as long as it's not inordinately expensive. Any suggestions?

Anybody? Or is the silence just a vote for Blender?

edit: You know what I didn't realize this was the cobol cavern game programming thread, this would probably be a better question for another game development thread.

Vinterstum
Jul 30, 2003

Paniolo posted:

For game dev purposes, C# supports more relevant platforms than Java- iOS, Android, Xbox, plus all relevant consumer desktop platforms. Of those Java only runs on desktops and Android, afaik.

It's not really correct to say that C# "supports" iOS and Xbox, though... For the former you're then stuck with MonoTouch or Unity (i.e. going through 3rd party engines that may not be suitable for you), and for the latter it means XBLA only (and not native XDK).

For anyone with good reasons to care about being *fully* cross-platform, there really aren't any alternatives to C++.

roomforthetuna
Mar 22, 2005

I don't need to know anything about virii! My CUSTOM PROGRAM keeps me protected! It's not like they'll try to come in through the Internet or something!

Vino posted:

Anybody? Or is the silence just a vote for Blender?
I like Anim8or, but I'm a programmer and suck at all the graphical things, so I didn't want to weigh in when someone else might have a better answer. Also I don't know if Anim8or's various exports are any use for what you do, I wrote my own converter from its native file format. Also as far as I know it's mostly just skeletal animations.

But that very limited nature of it is what makes it such a simple interface to use. (Also it's free.)

Paniolo
Oct 9, 2007

Heads will roll.

Vinterstum posted:

It's not really correct to say that C# "supports" iOS and Xbox, though... For the former you're then stuck with MonoTouch or Unity (i.e. going through 3rd party engines that may not be suitable for you), and for the latter it means XBLA only (and not native XDK).

For anyone with good reasons to care about being *fully* cross-platform, there really aren't any alternatives to C++.

I don't disagree, but the comparison wasn't to C++, it was to Java.

Vino
Aug 11, 2010

roomforthetuna posted:

I like Anim8or, but I'm a programmer and suck at all the graphical things, so I didn't want to weigh in when someone else might have a better answer. Also I don't know if Anim8or's various exports are any use for what you do, I wrote my own converter from its native file format. Also as far as I know it's mostly just skeletal animations.

But that very limited nature of it is what makes it such a simple interface to use. (Also it's free.)

Are you sure? The website has frames, a webring, and a spinning "enter" animation on the front page.

Vinterstum
Jul 30, 2003

Paniolo posted:

I don't disagree, but the comparison wasn't to C++, it was to Java.

Absolutely, it's just kinda like debating whether a Ford or a Toyota float better. Both fine car brands, just kinda suck at being boats.

(That's right bitches, a car analogy).

roomforthetuna
Mar 22, 2005

I don't need to know anything about virii! My CUSTOM PROGRAM keeps me protected! It's not like they'll try to come in through the Internet or something!

Vino posted:

Are you sure? The website has frames, a webring, and a spinning "enter" animation on the front page.
So you see why I'd be reluctant to recommend it! (When I got it I was linked to the second page so I at least missed the webring and spinning enter.)

It's also essentially not been updated since 2006.

ZombieApostate
Mar 13, 2011
Sorry, I didn't read your post.

I'm too busy replying to what I wish you said

:allears:
Fuuuuuuuuck I hate programming sometimes. I just spent several days trying to figure out what went wrong in my conversion from OpenGL 2.x to 3.x and vertex arrays to VBOs/VAOs. Not only did my research leave me with an rear end backward impression of how VAOs are supposed to work, but I introduced a stupid little vertex index offset bug and every time I started to investigate one possibility, it started to look like the other was actually the problem.

On the one hand, I'm relieved that it's finally fixed, but on the other hand I'm pissed off that it took this long to figure it all out. Some of the documentation for the newer OpenGL stuff is absolute garbage. The docs for glDrawElements say the last parameter is supposed to be a pointer to your array of indices, but of course what it ACTUALLY wants is an offset into the buffer you already set. Not that I could find any mention of that until I stumbled across it in a tutorial on some random guy's website. And none of the tutorials I could find go beyond drawing a single box or triangle or whatever, so how VAOs and VBOs are supposed to be set up for multiple objects is a loving mystery unless you can find someone who's been through this mess already to tell you.

:argh: :cry: :psyboom: :suicide:

Take your pick. gently caress.

AlMightyBawb
Jun 1, 2009
I'm doing a games technology uni course and it's high time I picked up some books. Basically lots of C++ and a good chunk of maths. What books and/or resources would goons recommend? Assume little to no programming knowledge. :cheers:

Adbot
ADBOT LOVES YOU

ZombieApostate
Mar 13, 2011
Sorry, I didn't read your post.

I'm too busy replying to what I wish you said

:allears:

AlMightyBawb posted:

I'm doing a games technology uni course and it's high time I picked up some books. Basically lots of C++ and a good chunk of maths. What books and/or resources would goons recommend? Assume little to no programming knowledge. :cheers:

MSDN - Great for finding out what built in language features do.
StackOverflow - If you have a specific question or bug you need help finding.

I learned the basics in class, so I guess I don't really have much else that would be immediately helpful. Find a tutorial someplace and go to town I guess? I know MSDN has some stuff (http://msdn.microsoft.com/en-us/visualc/ee340952).

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply