triwebb1
Community Member

Posts: 8
|
 |
« on: June 02, 2008, 01:53:17 AM » |
|
Hi. I am a complate noob to any kind of visual (2d/3d) programming, and I am trying to use TV3d to render a simple scene. I am using VC#.
What I have is a three dimensional matrix, and what I want is a grid of points of lights, one point for each cell in this matrix, and the intensity of the light should be dependant on the value in the cell the point represents. My matrix is of a variable size, and is always smaller than 500x350x500 due to memory constraints, and the is full of doubles .
So how should I do this? I can't even get anything to render. I have spent several hours going over a couple examples, and I have a pretty good grasp on them, but I'm not sure how to do what I want. Is there a way to creat individual light sources for each point, or do I have to create a single vertex for each point, or do I have to create a sphere? I think the light source method would be the simplist, but I don't know if that can be done.
So once I have this 3d grid of points rendered, I need to be able to rotate it in all directions, and zoom in and out. The background should be all black, and the light color probably white.
This seems so simple, but I have spent hours trying to get it to work, and now I have run into a memory problem - I run out of memory and begin trying to write over protected memory when creating verticies (I am trying the single vertex method). Can anybody help me out? You don't have to write it all for me if it's too much work, but I would imagine that this would take an experience programmer 5 to 10 minutes to whip up a but of code for me.
I would greatly appreciate any help I can get on this.
|
|
|
|
|
Logged
|
|
|
|
|
pizzayoyo
|
 |
« Reply #1 on: June 02, 2008, 10:52:14 AM » |
|
I don't quite understand what you're trying to do... You want a grid of 500x350x500 point lights? If so, that's waaay too many lights.
|
|
|
|
|
Logged
|
|
|
|
Lenn
Customers
Community Member
    
Posts: 351
Ivan Miskelic
|
 |
« Reply #2 on: June 02, 2008, 11:50:53 AM » |
|
You should try explain what you are trying to do a little bit better. Trying to lit a scene? Most cards have a max of 8 dynamics lights at a time, some PS3 shaders allow more, but hardly more than 32, also depending on type of lightingmode. Maybe you just need a lightmap if the lights are static? Or are you trying to create geometry proceduraly? That would have nothing to do with lights, because vertices and lights have nothing to do with eachother. Explain further, eh.  And have a look at the wiki examples over and over and over and over again. Once you get the logic behind it everything will click.
|
|
|
|
|
Logged
|
Theres a shadow just behind me. shrouding every step I take. Making every promise empty. pointing every finger at me. Waiting like a stalking butler, who upon the finger rests. Murder now the path of must we, just because the son has come.
|
|
|
|
newborn
|
 |
« Reply #3 on: June 02, 2008, 11:52:05 AM » |
|
Why such a high quantity of lights? Can't you just represent your lights with meshes?
edit: damnit Lenn was faster than I on this one
|
|
|
|
|
Logged
|
|
|
|
AriusEso
Customers
Community Member
    
Posts: 317
Esoteric
|
 |
« Reply #4 on: June 02, 2008, 11:57:03 AM » |
|
This is all technically true. But you can have hundreds, nay thousands, of lights on modern hardware if you rig an efficient deferred rendering line.
|
|
|
|
|
Logged
|
|
|
|
jviper
Community Member

Posts: 1280
Discipline in training
|
 |
« Reply #5 on: June 02, 2008, 11:58:01 AM » |
|
Yeah, you cannot have that many lights. It almost sounds like what you want to do is use a particle system. In a particle system, you may not be able to produce everything that lights can do, but you may be able to get the effect. If you set up this matrix of thousands of particles, and give the particles a sort of flare texture, you may be able pull off that sort of feel. But you will not be able to make all of those particles act exactly like lights to where they produce shadows and shading. Minimesh is another option. You can define a mesh for the minimesh system (in this case, your mesh might be a sphere), create the system with the number of meshes, then arrange each of the minimeshes.
|
|
|
|
|
Logged
|
JAbstract.....Don't just imagine, make it happen!
|
|
|
triwebb1
Community Member

Posts: 8
|
 |
« Reply #6 on: June 02, 2008, 12:53:49 PM » |
|
Wow, thanks for all the fast responses!
What I am doing is creating a Player Owned Structure Damage Simulator for EVE-Online. At the center of the box ( a 500km x 350km x 500km block of space) is the POS, and there is an array of turrets that is created by the user using the interface. This turret array stores data about each turret added to the array, and then when the user clikcs the draw button, the program calculates the average damage per second that will be dealt to a given ship at every point in space.
So programmatically this is represented by a matrix with one point for every cubic kilometer, and the values in the cells of the matrix range from 0 to 1, with 1 being the highest DPS.
What I need to do is represent this matrix visually so that the user can examine where the weak spots are in Player Owned Structure's defences.
I don't need every point to be a light source, I just thought that makes sense. I don't want any shadows at all to be created in this rendering, so I guess particles will work. As far as the light goes, what I want is every point to be white (and the background black) and the intensity of light coming off each point should be dependant on the value of the matrix that the point corresponds to.
Perhaps this could be done by changing the alpha of the texture on each particle? It would also be cool if the light could sort of bleed into space (glow effect?) so that areas with a a lot of high values glow brightly and stand out in this grid.
Does this help? I will research more about how to make particles and texture them.
Again, thanks for all the help!
|
|
|
|
|
Logged
|
|
|
|
Lenn
Customers
Community Member
    
Posts: 351
Ivan Miskelic
|
 |
« Reply #7 on: June 02, 2008, 01:09:06 PM » |
|
I used to play EVE, nice idea there.
Yes. Well then, just create your array containing x/y/z of each turret and assign a billboard or particle or minimsesh at that position. I believe particles would be best. Just create it and set it's x/y/z, for each one in the array. Then you need to decide wether you want to change alpha of each particle or it's size depedning on DPS, either will work well in terms of presentation but i think size would be better. The texture could simply be a white texture with a fadeout or star-effect in the alpha channel so each would look like a light/star/ or whatever the alpha looks like. Then, to get the glowing effect - simply use TVs internal glow effect (well duh?). I can imagine that would work really well. Then it's just a matter of adjusting to get exactly what you need.
When i say alpha in the texture i mean a DDS texture saved in mode A8R8G8B8 preferably, or anything that has alpha really. For this you need the dds plugin for photoshop to save it like that, but ther are other ways of assigning alpha to a texture too.
PS. did i just confuse billboards and particles and minimeshes? lol... each can have their properties set individualy, right? :| my brains a mush atm soo... anyway, either of those will work.
|
|
|
|
« Last Edit: June 02, 2008, 01:10:41 PM by Lenn »
|
Logged
|
Theres a shadow just behind me. shrouding every step I take. Making every promise empty. pointing every finger at me. Waiting like a stalking butler, who upon the finger rests. Murder now the path of must we, just because the son has come.
|
|
|
triwebb1
Community Member

Posts: 8
|
 |
« Reply #8 on: June 02, 2008, 01:56:02 PM » |
|
Ok, well I have no idea how to do any of that. Are there any good tutorials online somewhere? Or even simple samples that show how to do this? I am not finding anything...
The best sample I have found is the "Vehicle Starter Kit", but it doesn't use any particles or minimeshes, as far as I can tell.
|
|
|
|
|
Logged
|
|
|
|
triwebb1
Community Member

Posts: 8
|
 |
« Reply #9 on: June 03, 2008, 12:05:29 AM » |
|
Well, I got the minimesh deal to work. I had to shrink the number of minimeshes though, because if I had one for every point I would require 87.5 million minimeshes, and it ran out of memory... So I shrunk it to a 50x35x50 grid that only requires 87.5k minimeshes and it works.
However, I am now thinking that this isn't the best way of representing the values. Can anyone think of a better way? I'm thinking maybe something like an infrared viewer that shows radiant hotspots (no points, but like colored gases in space). This is far more complex than minimesh spheres, and I don't even no where to begin.
Any ideas?
Oh, now that I think about it, I think I will have to create a static particle system and color the particles based on the matrix values. I guess I will go research particle systems now...
Oh, and I have another issue now. I want to be able to use the mouse to manipulate the camera, with the wheel zooming in and out, and the left mouse button and dragging to rotate around the center of the grid. I have figured out the zoom part, but I can't seem to get the camera to rotate around a point my click-dragging. Any links to examples? I have done a little searching, but I can't get the one example I found to work for me. I guess I don't have to move the camera; maybe I can rotate/scale the grid/mesh/particle system. Hmmm....
|
|
|
|
|
Logged
|
|
|
|
|
DanDixon
|
 |
« Reply #10 on: June 03, 2008, 01:10:37 AM » |
|
Have you seen the wiki yet? http://wiki.truevision3d.com/I'm not entirely clear on what you're doing, but you can use mini-meshes to create your own particles system (this is what you've already done and what I did in my project http://universesandbox.com/ ). The particle system that's built into Truevision doesn't allow specific control over the position of the particles so mini-meshes are probably what you want. And rotating the camera? Check out some of the samples they show how to rotate the camera. But the quick one line answer is... TVMath.MoveAroundPoint
|
|
|
|
|
Logged
|
|
|
|
triwebb1
Community Member

Posts: 8
|
 |
« Reply #11 on: June 03, 2008, 01:40:46 AM » |
|
I'm glad you told me that I cannot control the position of individual particles before I spent hours looking into particle systems! Maybe I should check them out anyway - the knowledge may be useful in the future...
Well, if I can't create a nice colored gas thing then I may have to settle for a series of 2d colorized slices of the matrix that can be stepped through one at a time. I'm not even sure how to do that though...
|
|
|
|
|
Logged
|
|
|
|
|