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
Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
Also Crysis was awesome.

Adbot
ADBOT LOVES YOU

BattleMaster
Aug 14, 2000

Wait people still think that graphics and gameplay are tradeoffs? Even though the skills needed to develop either don't really overlap?

shodanjr_gr
Nov 20, 2007

BattleMaster posted:

Wait people still think that graphics and gameplay are tradeoffs? Even though the skills needed to develop either don't really overlap?

Fallout 3 would have been so much better if it didn't use 3D graphics. Bethesda should have opted for ASCII visuals instead, they improve gameplay :iamafag:.

heeen
May 14, 2005

CAT NEVER STOPS

Avenging Dentist posted:

Oh come the f8ck on people! sure it looks great, sure its real time, sure its closer to photo realistic, but who cares?!!?
Its not gonna make the game any better, some of the best games I've played looked like poo poo, and that is one of the most talked about issues of this gen, the fact that a LOT of man power goes to the graphics, rather than going on better AI/ideas/physics.
I respect them for making such an advanced engine, but this simply shouldn't be of interest to the gaming industry, we're not watching a movie here, we're playing a game, and as seen in games such as Crysis , graphics dont make a game.

Maybe go rant in the gameplay development thread?

haveblue
Aug 15, 2005



Toilet Rascal

heeen posted:

Maybe go rant in the gameplay development thread?

Maybe go tell him off in the Kotaku thread he copied and pasted that from? And then we can all go back to discussing 3D graphics programming instead of YCSery?

I could barely follow that Crytek whitepaper, but just enough to see that my guess was completely wrong. I didn't think we had reached the point where a true volumetric effect like that was possible, I thought screenspace tricks were still a necessity.

shodanjr_gr
Nov 20, 2007

sex offendin Link posted:

I could barely follow that Crytek whitepaper, but just enough to see that my guess was completely wrong. I didn't think we had reached the point where a true volumetric effect like that was possible, I thought screenspace tricks were still a necessity.

They use a reflective shadowmap (downsampled render target from the light's POV) to capture the first bounce, but I'm trying to figure out exactly what they do after that...it looks like they generate point light sources from the RSM which are then stored into a volume and their radiance iteratively propagated?

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!
Looks like the scene is rendered into a reflective shadowmap, which is used to generate point sources that propagate into a volume texture of SH coefficients.

Looks like this is repeated, scene probes collect light from the propagation volume and scatter them back out into the light volume for multiple bounces.

This isn't a staggeringly inventive approach, it's just that they managed to make most of this poo poo happen on the GPU without bouncing back to the CPU which is the real accomplishment.

Contero
Mar 28, 2004

Where do you guys look for research-y type free models to test out rendering techniques with?

In particular I'm looking for a huge, textured, relatively nice looking landscape mesh to play around with.

MasterSlowPoke
Oct 9, 2005

Our courage will pull us through
Rendering a heightmap would be a pretty easy way to make your own landscape.

shodanjr_gr
Nov 20, 2007

Contero posted:

Where do you guys look for research-y type free models to test out rendering techniques with?

In particular I'm looking for a huge, textured, relatively nice looking landscape mesh to play around with.

Can't say I've ever seen any "reference" terrain models (like Cornell Box/Sponza Atrium/Stanford Bunny/Little Bhuda/Dragon etc) . Just do what MasterSlowPoke suggests, displacement mapping on a planar mesh with reads off a perlin noise texture, it gives some very nice results. If you feel like it you can do coloring based on the displacement value to simulate water/snowy mountains/whatever.

Vinterstum
Jul 30, 2003

Contero posted:

Where do you guys look for research-y type free models to test out rendering techniques with?

In particular I'm looking for a huge, textured, relatively nice looking landscape mesh to play around with.

Check out Terragen 2. It can procedurally generate landscapes based on a ton of different options, and export it as a heightmap or even (I think) as a mesh. There's a free version and a commercial version, though I'm not sure what's available in which.

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!
If you're even thinking about landscapes then you probably want to grab World Machine.

Sex Bumbo
Aug 14, 2004
Does anyone know how the "angled brush strokes" filter in photoshop works? I think it would be pretty darn cool if I could do this in real time. Unfortunately, I don't really know how it works after messing around with some test images. I get that it's doing some segmentation of light and dark regions to angle the strokes differently, but how are the strokes applied? I'm looking for a 2D solution for this.

heeen
May 14, 2005

CAT NEVER STOPS

Contero posted:

Where do you guys look for research-y type free models to test out rendering techniques with?

In particular I'm looking for a huge, textured, relatively nice looking landscape mesh to play around with.
There's the puget terrain, it's not textured per se, though.

Jo
Jan 24, 2005

:allears:
Soiled Meat
Bit of a late comment, but thanks to everyone who responded. I decided on JOGL and it was pretty painless. Good stuff.

slovach
Oct 6, 2005
Lennie Fuckin' Briscoe
Ok, I'm completely new to DX9, so here's a couple dumb questions, do I...


Need to set an FVF if I'm using ID3DXSPRITE?

What about a cullmode? Isn't counter clockwise typically the default? That seems to cull the side of the sprite that is facing me...

Is it really slow like I've heard rumors of? I'm getting like 1600 fps drawing something like 1400 sprites, so I don't think it's going to be a problem either way. :downs:

slovach fucked around with this message at 11:04 on Aug 31, 2009

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!

slovach posted:

Need to set an FVF if I'm using ID3DXSPRITE?
You shouldn't use FVFs ever, they're obsolete with D3D9 and aren't even in D3D10. Use vertex declarations, they're better in every way.

i.e.: http://msdn.microsoft.com/en-us/library/bb174365%28VS.85%29.aspx

quote:

What about a cullmode? Isn't counter clockwise typically the default?
Neither cull mode is inherently "better" but you should try to be consistent with which one you choose to use as the "default."

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

OneEightHundred posted:

You shouldn't use FVFs ever, they're obsolete with D3D9 and aren't even in D3D10.

They're not that bad when you're just figuring poo poo out, since there's less to think about with FVF.

slovach
Oct 6, 2005
Lennie Fuckin' Briscoe

OneEightHundred posted:

You shouldn't use FVFs ever, they're obsolete with D3D9 and aren't even in D3D10. Use vertex declarations, they're better in every way.

i.e.: http://msdn.microsoft.com/en-us/library/bb174365%28VS.85%29.aspx

Neither cull mode is inherently "better" but you should try to be consistent with which one you choose to use as the "default."

Thanks, I'll switch to CreateVertexDeclaration.


And is it normal for texture changes to pound my rear end so much? It's especially noticeable when I'm drawing a ton of sprites. Using only one texture my fps sits at almost 300 when drawing 40,000 something sprites. Alternating between 3 textures, it's floating around 100... that's a 6.67ms difference in render time. Obviously this is a bit extreme and in reality I'll never be trying to render so much at once, but just something I noticed when playing around.

haveblue
Aug 15, 2005



Toilet Rascal

slovach posted:

Thanks, I'll switch to CreateVertexDeclaration.


And is it normal for texture changes to pound my rear end so much? It's especially noticeable when I'm drawing a ton of sprites. Using only one texture my fps sits at almost 300 when drawing 40,000 something sprites. Alternating between 3 textures, it's floating around 100... that's a 6.67ms difference in render time. Obviously this is a bit extreme and in reality I'll never be trying to render so much at once, but just something I noticed when playing around.

If you do several thousand of them per frame, then yes. Try reorganizing the sprites so you can draw them in batches of the same texture without having to rebind.

slovach
Oct 6, 2005
Lennie Fuckin' Briscoe

sex offendin Link posted:

If you do several thousand of them per frame, then yes. Try reorganizing the sprites so you can draw them in batches of the same texture without having to rebind.

I had the impression that ID3DXSPRITE had a flag that attempted to do this, or at least that is what it sounded like to me.

quote:

D3DXSPRITE_SORT_TEXTURE: Sort sprites by texture prior to drawing. This can improve performance when drawing non-overlapping sprites of uniform depth.

Sex Bumbo
Aug 14, 2004
D3DXSPRITE_SORT_TEXTURE should work fine

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!

Avenging Dentist posted:

They're not that bad when you're just figuring poo poo out, since there's less to think about with FVF.
I thought the opposite, since FVFs force you to care about what order the vertex data is in, whereas vertex declarations let you just take an existing structure and make a vertex declaration out of it. The only "hard" part is determining the offsets, which you can just use macros for.

Re: Sprite sorting, yes, any state change (changing buffer, shader, texture, render target, etc.) is expensive, draw calls by themselves are expensive too. The number of draw calls you make is one of the biggest limiting factors in DX9.

The best thing to do to minimize both if you need sorted sprites is to use an atlas, which is one texture containing a lot of different sprites, and each sprite uses a piece of that texture. Since your sprites don't tile, this shouldn't be a problem.

OneEightHundred fucked around with this message at 12:32 on Sep 1, 2009

The1ManMoshPit
Apr 17, 2005

Does anybody know of an alternative to glReadPixels on the iPhone (OpenGL ES 1.5)? I'm profiling a section of my code that needs to read some data that I've rendered into an FBO and a quarter of my time is spent just copying data out with glReadPixels. This seems especially ridiculous since the iPhone's video memory is actually shared main memory iirc, so it seems like I should just be able to get a pointer to it somehow which would obviously speed my code up immensely.

tripwire
Nov 19, 2004

        ghost flow

The1ManMoshPit posted:

Does anybody know of an alternative to glReadPixels on the iPhone (OpenGL ES 1.5)? I'm profiling a section of my code that needs to read some data that I've rendered into an FBO and a quarter of my time is spent just copying data out with glReadPixels. This seems especially ridiculous since the iPhone's video memory is actually shared main memory iirc, so it seems like I should just be able to get a pointer to it somehow which would obviously speed my code up immensely.

Are you using BGRA format?

The1ManMoshPit
Apr 17, 2005

tripwire posted:

Are you using BGRA format?

I'm not right now because from all I've read ReadPixels can only return RGBA in OpenGL ES, but I could easily change to use any pixel representation if it meant avoiding the bottleneck.

Edit: Apparently it can also return in an implementation dependent format, but when I tried the following code:

code:
        GLint theint;
        glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES, &theint);
        printf("0x%x\n", theint);
        
        GLenum glerr = glGetError();
        printf("0x%x\n", glerr);
it outputs

code:
0x0
0x0
Which I guess means that it doesn't have an implementation specific format?

Edit2: Tested GL_BGRA in my ReadPixels call and it turns out that it works, but has no difference performance wise. Tested every possible permutation of GL_RGBA/GL_BGRA and different pixel formats (UNSIGNED_BYTE, UNSIGNED_SHORT_4_4_4_4_REV...) and the only pixel format that doesn't give an error is UNSIGNED_BYTE. Are there any other ideas or am I just stuck with this annoying unavoidable cpu-stealer?

The1ManMoshPit fucked around with this message at 23:38 on Sep 2, 2009

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!
A better question would be what you are trying to do. ReadPixels has been glacially slow for about as long as OpenGL has existed, mainly because it's a blocking operation. Even apps that do use it for feedback (i.e. histograms) tend to rescale the scene to a smaller buffer to cut down on the amount of data that has to be transferred.

The1ManMoshPit
Apr 17, 2005

OneEightHundred posted:

A better question would be what you are trying to do. ReadPixels has been glacially slow for about as long as OpenGL has existed, mainly because it's a blocking operation. Even apps that do use it for feedback (i.e. histograms) tend to rescale the scene to a smaller buffer to cut down on the amount of data that has to be transferred.

Unfortunately I'm doing a transform on all the pixels on screen and I need the result in main memory. I'm already at half-resolution and the results are really not good enough for what I want to do, which is why I'm profiling trying to save some time so I can go back to full resolution. After some optimizations in the code ReadPixels is now about 1/3 of the total time, and there's not much left in my code that can be optimized much more.

I considered a shader but it's just not an option because I still need to get the final result into main memory so I can do more work with it there, so I would still need the ReadPixels call, and shaders also are only usable on a tiny fraction of the iPhones/iPod touches out there.

Scarboy
Jan 31, 2001

Good Luck!
In my experience, if you do ReadPixels after you've rendered everything in a frame it will be much much much faster. I haven't found any alternative to using it on the iPhone so this makes me happy for now.

tripwire
Nov 19, 2004

        ghost flow
Sorry I wasn't much help The1ManMoshPit, the only reason I said try BGRA was because some comments on a GPGPU website led me to believe that for most ATI and NVIDIA cards, BGRA was the native format and RGBA was a little slower, obviously that isn't true for the iphone :(


I'm a real novice at 3d stuff and was wondering if anyone could give me any advice on getting a (relatively) simple program to work.
A while ago I made a program which generated descriptions of triangles (i.e. it would make a list of 200 or so collections of 6 float coordinates between 0 and 1 and 4 float colours between 0 and 1). I was using cairo to draw the triangles, comparing them against a source image and giving a similarity score out of 1.0 with 0 being completely dissimilar and 1 being identical.

The source code is all in this thread here: http://forums.somethingawful.com/showthread.php?threadid=3197725

As posted the code doesn't work but I have no idea why; I know I screwed up something with opengl but I'm not experienced to know what.
It will run, but all the pictures it generates seem to be utterly random rather and never improve in fitness, which doesn't happen when rendering with cairo.

If anyone could give the second class in that thread, "render.py" a look over and tell me what I'm doing wrong or not doing I'd greatly appreciate it.

fankey
Aug 31, 2001

I have a 'terrain' mesh - not actually a terrian but a 2d grid of points equally spaced in the x and z dimensions. I'm assigning the y value to visualize some real time data. I'd like to assign colors which indicate the height - something like this



What would be the most efficient way to accomplish this? I'm using the 3d stuff built into WPF which might limit the approaches I can take.

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!
Option A: Make a 2D texture, colorize it based on the height, and assign the texture coordinates of the "terrain" mesh to the corresponding locations on that texture.

Option B: Make a 1D texture containing the colors in order, and reference it based on height.

OneEightHundred fucked around with this message at 17:30 on Sep 8, 2009

haveblue
Aug 15, 2005



Toilet Rascal
Option C: Don't make a texture, use the vertex color attribute.

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!
Yeah you could do that too.

A side-effect of Option A is you can use a lower-resolution mesh than the data and it will still look OK.

A side-effect of Option B is that it'll transition properly with high-frequency data, making it probably the best choice.

Goreld
May 8, 2002

"Identity Crisis" MurdererWild Guess Bizarro #1Bizarro"Me am first one I suspect!"
Maybe less efficient but more accurate (and if you're dealing with scientific visualization this can be important) - use a HSL transform function for each vertex color, like haveblue mentioned.

If you use a texture, you'll get artifacts, and that can be really loving bad, as you may see stuff that doesn't actually exist. Even if you have antialiasing all the way up, and really nice anisotropic filtering, you can still get tiny artifacts, and depending exactly what you're graphing, this can be bad.

Also, if you need to change colors based on a power of the HSL function or on a logarithm scale, this can make the texturing problems worse (usually in the form of banding)


Stanlo posted:

Does anyone know how the "angled brush strokes" filter in photoshop works? I think it would be pretty darn cool if I could do this in real time. Unfortunately, I don't really know how it works after messing around with some test images. I get that it's doing some segmentation of light and dark regions to angle the strokes differently, but how are the strokes applied? I'm looking for a 2D solution for this.

It's probably a Gabor filter. There's a recent Siggraph paper that uses Gabor filters to create noise: here.

It's a well-written paper, which even includes some source code and a cool iphone app.

Goreld fucked around with this message at 18:10 on Sep 8, 2009

fankey
Aug 31, 2001

OneEightHundred posted:

Option A: Make a 2D texture, colorize it based on the height, and assign the texture coordinates of the "terrain" mesh to the corresponding locations on that texture.

Option B: Make a 1D texture containing the colors in order, and reference it based on height.
Thanks, Option B appears to work pretty well. It doesn't look like WPF has a concept of vertex color so I wasn't able to use that approach. Luckily this isn't true scientific visualization - it's for real time audio acoustical measurements so the specific colors used don't need to be 100% accurate.

Spite
Jul 27, 2001

Small chance of that...

The1ManMoshPit posted:

Does anybody know of an alternative to glReadPixels on the iPhone (OpenGL ES 1.5)? I'm profiling a section of my code that needs to read some data that I've rendered into an FBO and a quarter of my time is spent just copying data out with glReadPixels. This seems especially ridiculous since the iPhone's video memory is actually shared main memory iirc, so it seems like I should just be able to get a pointer to it somehow which would obviously speed my code up immensely.

As a rule, you should never, ever use it. Ever. Really. What are you doing that requires the readback? Is there any other way you can do it?

Femtosecond
Aug 2, 2003

I have a question that is sort of more a vector math question. I haven't had to deal with vector math for a few years and my old vector math text is sitting in a box at my parent's house so I'm not sure what to do.

Essentially I have a point in 3D space with an orientation. I want to draw a rectangle around that point so that when I change the direction it is oriented in the rectangle around it changes with it.

To create the rectangle I need a minimum extent vector and a maximum extent vector. I feel like the problem is one of offsetting the local xyz components of the target vector by some amount to calculate where this min/max extent vector would be and then finding the world position of this offset vector. I'm not sure how to do this last translation.

I was looking around the library I'm using but I couldn't figure out how to do what I wanted. Maybe I'm not on the right track after all.

Could anyone push me in the right direction?

Spite
Jul 27, 2001

Small chance of that...

Femtosecond posted:

I have a question that is sort of more a vector math question. I haven't had to deal with vector math for a few years and my old vector math text is sitting in a box at my parent's house so I'm not sure what to do.

Essentially I have a point in 3D space with an orientation. I want to draw a rectangle around that point so that when I change the direction it is oriented in the rectangle around it changes with it.

To create the rectangle I need a minimum extent vector and a maximum extent vector. I feel like the problem is one of offsetting the local xyz components of the target vector by some amount to calculate where this min/max extent vector would be and then finding the world position of this offset vector. I'm not sure how to do this last translation.

I was looking around the library I'm using but I couldn't figure out how to do what I wanted. Maybe I'm not on the right track after all.

Could anyone push me in the right direction?

If you assume the rectangle is at 0,0,0, you can generate the 4 vertices for your rectangle by adding/subtracting. You can then use the orientation vector you have as part of the basis for a rotation matrix. (ie, if the rectangle is 'facing' down +Z, then you use 1,0,0 as the X and 0,1,0 as the Y, while the orientation vector is Z) Is that what you mean?

Adbot
ADBOT LOVES YOU

Femtosecond
Aug 2, 2003

Spite posted:

If you assume the rectangle is at 0,0,0, you can generate the 4 vertices for your rectangle by adding/subtracting. You can then use the orientation vector you have as part of the basis for a rotation matrix. (ie, if the rectangle is 'facing' down +Z, then you use 1,0,0 as the X and 0,1,0 as the Y, while the orientation vector is Z) Is that what you mean?

I suppose so. I guess to switch between local and world space I need to have a look how the rotation matrix is affecting the matrix. I guess you just apply the same rotation on both the position and the new offset position you've just calculated?

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