Sign in to follow this  
JPetitti

[SlimDX][C#] Questions on getting started

Recommended Posts

JPetitti    100
Hey all, I've decided to try my hand in the world of game programming. I have quite a bit of C# experience, but none with DirectX. After doing quite a bit of research and option weighing I've settled on SlimDX and C# as my weapon of choice. I also decided to start the process by creating a world/terrain editor for the game I'll eventually be working on. Right now I've got it up and running with a basic terrain grid displaying. I have a few questions that I'm hoping the community can lead me in the right direction on. I've done a lot of searching on the internet, but I keep ending up at tutorials at least 4 years old. So I figured I would ask here to get fresh opinions. Texturing: Lets say the base texture across the terrain is grass, i would like to draw the roads in for example. Here's an example of what I'm talking about http://www.youtube.com/watch?v=eKPi_w4bWrY 1)How is this done? 2)Is "texture splatting" the correct methodology? 3)If not what direction should i be looking? 4)Do i repeat the textures across all tiles and modify blend values? 5)Since every vertex needs specific u and v texture coordinates, I would NOT use indicies for the terrain section correct? Modifying Height Map Dynamically: 6)Once i know which verticies will be affected and by how much, do i simply edit my vertex array and re-write it to the vertex buffer? Camera Movement: I've read a few tutorials and posts that say never move a camera position once declared, instead always perform transforms on the world matrix. 7)Is this really the best way to do things? 8)Why? Any help at all will be much appreciated! Thank in advance, -Joe

Share this post


Link to post
Share on other sites
MaulingMonkey    1730
Quote:
Original post by JPetitti
1)How is this done?

One of two ways.
1) Ahead of time -- the 'textures' are blended together into a single bitmap/d3d texture for a region ahead of time (the general idea behind megatexturing, generally)
2) By binding multiple textures simultaniously and adding them together at runtime with a pixel shader
clicky

Quote:
2)Is "texture splatting" the correct methodology?

It's an appropriate term.
Quote:
4)Do i repeat the textures across all tiles and modify blend values?

That's an option.
Quote:
5)Since every vertex needs specific u and v texture coordinates, I would NOT use indicies for the terrain section correct?

As in an index buffer? Index buffers make sense anywhere you're reusing points. If you have, for example, a heightmap rendered with quads, and you're using wraparound u/v address mode instead of clamping, each point of the quad/tile will typically be shared between 6 triangles with identical x/y/z/u/v, so using an index buffer makes a lot of sense:
 / |2/
/ 1|/3
---o---
6/|4 /
/5| /


Quote:
Modifying Height Map Dynamically:
6)Once i know which verticies will be affected and by how much, do i simply edit my vertex array and re-write it to the vertex buffer?

Yes.

Quote:
Camera Movement:
I've read a few tutorials and posts that say never move a camera position once declared, instead always perform transforms on the world matrix.
7)Is this really the best way to do things?
8)Why?

In D3D you have 3 matricies which are multiplied against each other for you -- model, projection, and view. I believe what they're getting at is you can fill out the non-position stuff of a camera into one, and then not have to reset that matrix each frame like you typically would with all the more dynamic ones. Not sure if it actually matters though.

Share this post


Link to post
Share on other sites
JPetitti    100
Thanks Monkey!

I'll start looking into pixel shaders to handle texturing at runtime.
I was however, wondering if it's also possible to use the render pipeline without the use of shaders to achieve the same goal.

As for the uv coords, i was mistaken on how they work. After a little more research, i now see how triangles can share the same uv coords of a vertex.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this