How to build the 3D-graphic in VB .NET?

D

Dr. Zharkov

Hello. Inform, please, on what site it is possible to find materials on
construction of the three-dimensional graphic of function z=f(x,y) with the
help of Visual Basic .NET and GDI+?

Beforehand many thanks for your answer. Best regards, Dr. V.A. Zharkov.
Moscow, Russia.
 
R

Robin Tucker

Dr Zharkov,

3D graphics is a large and complex subject. There are any number of ways to
perform what you ask - using GDI, Win32, DirectX, OpenGL (you see my point).
You need to read about matrix math and vector math because, unless you use
DirectX or OpenGL, GDI+ will only see what you throw at it in terms of x,
y - GDI is a 2D rendering library. But ultimately, all 3D graphics
libraries transform down to 2D after projection.

My recommendation is to using DirectX 9, which gives you a set of classes
and methods to help out with common 3D graphics operations. Of course, this
will require a lot of reading :p
 
F

Fergus Cooney

Hi Robin,

Lol. I think Dr. Zharkov might know a little bit about maths! ;-))

Regards,
Fergus
 
R

Robin Tucker

I have no idea who Dr Zharkov is, only that the question perhaps required a
somewhat patronising answer! I haven't tried using D3D in .NET yet - but
either way, if one knows about mathematics, it won't be too difficult to
pick up the basics of 3D projection and transformation.
 
D

Dr. Zharkov

Mr. Robin Tucker.
1. Thanks for your answer and recommendation.
2. On a site http://codeguru.earthweb.com/opengl/OG.html there is article
"Function graphics in 3D"of the Russian scientist Alexander Chernosvitov
about construction of the three-dimensional diagrams of functions with the
help of Visual C++ 6.0 and OpenGL. Mister Chernosvitov has issued in Russia
the book about construction of the three-dimensional diagrams of functions
with the help of Visual C++ .NET and OpenGL. In Russia and other countries
are issued the books with the theory and programs about construction on
building the 3D-graphics of functions with the help of Visual C++ 6.0 and
GDI.
3. Inform, please, to me about articles and books on building the 3D-graphic
of function z=f(x,y) with the help of Visual Basic .NET, Visual C# .NET or
Visual C++ .NET and GDI+.
Beforehand many thanks for your answer. Best regards, Dr. V.A. Zharkov.
Moscow, Russia.
 
R

Robin Tucker

Ok, you won't find a book on using GDI+ to perform 3D graphics. It just
isn't done that way. There are lots of books available on using DirectX.

There are many examples, here:

http://www.c-sharpcorner.com/Directx.asp

You can post questions/get answers from the forums here:

www.flipcode.com

www.gamedev.net

and of course, if you want to proceed with DirectX and C#, you will using
Managed DirectX. There are tutorials here for this:
http://staff.develop.com/candera/weblog/stories/2003/01/26/managedDirect3dInitializegraphics.html.
Basically, you are using Interop services to utilize the D3D COM interfaces.

If you are new to 3D graphics, the 3d graphics bible is of course
http://www.amazon.com/exec/obidos/tg/detail/-/0201848406/102-2335352-4230557?v=glance,
by foley and van-dam. Perhaps not such a practical book, but provides
familiarity with all aspects of CG in use today.

There are many, many tutorials on the internet related to 3D graphics and I
have to admit I have found them to be more useful than most books. A google
search for "D3D C#" or "DirectX C#" will return many results.

Now finally, if you want to perform 3D graphics with GDI+, which is itself a
2D API, you need to write your own transformation methods. This will
involve the creation of a 3x3 or 4x4 matrix class, a vector/vertex class
and, well, basically, don't bother - you don't need to do this if you use
D3D.

The only thing I might ask is whether you already have knowledge of 3D
Computer Graphics. If not, some of the concepts involved in using D3D will
be difficult for a beginner. If you do, then I guess all you need to know
is how the interop works with D3D Com. Its fairly basic stuff.

I hope this is helpful.
 
R

Robin Tucker

Oh, and I forgot to add the newsgroup for managed directx:

microsoft.public.win32.programmer.directx.managed
 
D

Dr. Zharkov

Mr. Robin Tucker.
1. Thanks for a plenty of the references, but these references do not give
the answer to a question of the given theme: How to build the 3D-graphic in
VB .NET?
2. For building the 3D - graphics, I want to use only GDI+ and Visual Studio
..NET 2003 (without use DirectX).
3. In "amazon" are sold the two books on GDI+:
Symmonds N. GDI+ Programming in C# and VB .NET". APress, 2002. - 576 p.
Aitken P.G. .NET Graphics and Printing: A Comprehensive Tutorial and
Reference for Developers. Optimax Pub, 2003. - 576 p.
Both these publishing houses on the sites do not give the information on,
whether there is in these books a program for building the 3D - graphics.
If you have such information, whether inform, please, there is in these
books a program for building the 3D - graphics?

4. Inform, please, to me about articles and books with program for building
the 3D-graphics of function z=f(x,y) with the help of Visual Basic .NET,
Visual C# .NET or Visual C++ .NET and GDI+ (without use DirectX).

Beforehand many thanks for your answer. Best regards, Dr. V.A. Zharkov.
Moscow, Russia.
 
R

Robin Tucker

Ok Doc,

Heres the low down. What you are looking for is a "Software" rendering
engine. So you are looking for a general book on 3D computer graphics.
Here are a few things you might like to read-up on:

Vector Math
Matrix Math
Frustum Clipping
Backface Culling
Z Buffer
BSP Trees
Texture Mapping
Clip Planes

Dave Eberly is something of an expert on this. He posts on
comp.graphics.algorithms quite frequently, has written a few books and
releases his source code free of charge (its all C++).

http://www.magic-software.com/Books.html

What you are looking for is basic principles, from which you can of course
implement with whatever platform you desire - .NET or not. The only GDI+
functions you will use are drawing methods (clear window, draw line, draw
polygon/triangle). The rest you will have to implement yourself (matrix
transforms, perspective correction, frustum clipping, model representation).

So for example, with VB.NET, you will create a vector class:

public class Vector

public x, y, z As Double

' Some methods to operate on vectors

public function DotProduct ( Another As Vector ) as Double
return ( x * Vector.x + y * Vector.y + z * Vector.z )
end sub

public sub Normalize ()
Dim Length As Double = sqrt ( x * x + y* y + z * z )

if Length <> 0 then
x /= Length
y /= Length
z / = Length
end if
end sub

end class


As I say, you are looking for first principles - if you wish to use GDI+,
you will have to implement these yourself. You won't be able to perform
real-time texture mapping or z-buffering with GDI+, although you could
implement it yourself in software (it will be VERY slow however and you will
need to implement your own triangle scan convertor! This is a big job). A
few enthusiasts spend time writing and optimising their own software
rendering engines with advanced features (some of them are actually very
good), but 99.999% of people use either DirectX or OpenGL for real time
rendering. Of course, if you are talking about Ray Tracing, software
rendering is the way to go at present, but thats a different story
altogether!
 
D

Dr. Zharkov

Mr. Robin Tucker.
1. Many thanks for your very valuable advice.
2. On a site http://www.magic-software.com/Books.html I have looked the
book, recommended you: Schneider P.J. and Eberly D.H. Geometric Tools for
Computer Graphics. Morgan Kaufmann, 2002. - 1056 p.
In this book are given the small slices of the program on a pseudo-code, and
the program of construction of 3D - graphics is absent.
3. In the previous answer you have written: "A few enthusiasts spend time
writing and optimizing their own software rendering engines with advanced
features (some of them are actually very good):"

How to find the programs of these enthusiasts on building the 3D - graphics
of function z=f (x, y) and only for Visual Studio .NET (without use DirectX,
OpenGL, MathCAD, MatLab, Maple and similar packages)?

Beforehand many thanks for your answer. Best regards, Dr. V.A. Zharkov.
Moscow, Russia.
 
R

Robin Tucker

No, most of these enthusiasts write in basic vanilla C++ and use x86
assembly to optimise their code. They are attempting to get high quality 3D
engines using the power of todays CPUs, without using the GPU.

You won't find a reference for 3D graphics with .NET period. Sorry to say
this. Only by using D3D or GL will you find a book for a beginner. As I
say, you will have to read-up on first principles and implement this in your
own way in whatever language you like (I started learning 3D graphics ages
ago with a book containing "Basic" and "Psuedo-Code" which I implemented in
Borland Turbo C++ 2.0! It was painfull but it worked.

However, I am going to have a go at getting a GDI+ basic 3D rendering engine
going sometime this week; just to demonstrate to you some of the principles
involved. If you are patient, I will post it to this thread.

Just out of curiosity, why do you not wish to use DirectX or OpenGL?

Good luck!


Robin
 
D

Dr. Zharkov

Mr. Robin Tucker.
1. Once again many thanks for your very valuable advices.
2. Willingly I answer on your question (Just out of curiosity, why do you
not wish to use DirectX or OpenGL?).
Both DirectX, and OpenGL is the another's closed program ("black box"),
which we can not change, and we can only apply in the limited limits. At me
on a table lay the two books with the programs on construction of a surface
z=f (x, y) in the dialog box of Visual C++ .NET with the help OpenGL (in my
previous letter I have given the reference to one of articles in the
Internet from the book). It is the very complex programs, and that in them
to understand, it is necessary to spend a lot of time for initial study
OpenGL. In the books are constructed beautiful color cubes and surface for
demonstration to the schoolboys. At the decision of my engineering task it
is necessary to present this surface from sheet metal as a grid of finite
elements, to define through a finite element method (FEM) of strains and
stresses in nodes of this surface after treatment of the tool and from nodes
to construct the diagrams of strains and stresses. To construct such
diagrams, it is necessary to spend very many more time for the profound
study OpenGL, and still it is not known, whether the limited opportunities
OpenGL will allow to construct the diagrams at a good engineering level.
Naturally there is a question, what for to spend a lot of time for study
another's and complex OpenGL, when the same time can be spent for
development of the open program in the advanced platform Visual Basic .NET
2003, that I and try to make with your kind help.
3. I will be very grateful to you, if you will send materials on "GDI+ basic
3D rendering engine".
4. If this thread unexpectedly will break, it is possible to you to address
directly, and if it is possible, to what email or with what site?
Beforehand many thanks for your answer. Best regards, Dr. V.A. Zharkov.
Moscow, Russia.
 
R

Robin Tucker

Ok, I think I'm starting to see where you are coming from here. Heres the
problem: you want your students to be able to code this graphics
assignment/s but you don't want them to have to learn a graphics API in
order to do so? There is no solution to this problem unless you develop
yourself a class handling the basics required in order to complete the
assignment and give it to them to fill in the details. I can only give you
suggestions on how to proceed here, because my time is limited! The
solution as I see it is to use an Excel spreadsheet and to use VB scripts in
Excel to modify a 3D graph object in the spreadsheet. Thus you will avoid
any/all consideration of 3D graphics and are able to concentrate on
representation of the data you are studying. If you want anything more
complex, I'm afraid the creation of a .NET GDI+ 3D graphics library usable
by your students will be the next step, but it will be time consuming and
limited in scope.

I imagine you will want a 3D "sheet" and that you will be modifying control
points on the sheet in the graph according to values returned from your
experiments. This is easily achieved in Excel - quite possibly without any
programming at all (create a 3D graph from data in Excel).


Contact me by email (remove caps)
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top