Jump to content

  • Log In with Google      Sign In   
  • Create Account


Danny02

Member Since 21 Apr 2010
Offline Last Active May 20 2012 07:19 AM

#4866778 Distance Haze and cubemaps

Posted by Danny02 on 28 September 2011 - 07:09 AM

I looked at the wolfire blog post and I think this it what they did.
  • blurr your skybox very strong radial around the up-axis
  • u can probably use the term distant fog instead of haze
  • then just apply fog to your geometry based on the distance
  • lookup the color of the fog from your blurred cubemap
  • finished

as they also metioned, u can use the cubemap also for the ambient color in some way. So that the cubemap alone controls the enviroment lighting of your scene


#4845848 What are array indices? What's their advantage over vertex array data?r

Posted by Danny02 on 07 August 2011 - 12:00 PM

this also helps the GPU speed wise, because it can cache results from the same vertex index in the Post Transform Cache.


#4833460 totally confused on branching

Posted by Danny02 on 10 July 2011 - 03:10 PM

There is a quite cool app from AMD it's called GPU ShaderAnalyzer.
With this Tool u can analyze your shader code and it will show u the assembly code of your shader but also how much cycles it takes to compute.
And because of branching there is an MIN MAX and AVG number of cycles in the output which will show u the worst and best case of your branching code.(another feature is that it shows u if your shader is ALU-operation or texture sample bound etc)

This tool does only simulate AMD graphic cards so u won't know how your shader will perform on NVidia, but I think that nvidia was a bit badder with branching on their older cards then ATI.





#4833300 How shaders are connected with 3d Materials ?

Posted by Danny02 on 10 July 2011 - 05:17 AM

U could describe it this way, groups of materials use the same shader but with different parameters(shininess, how much reflection).
For example in 3D modeling tools u can often choose between different shading models Blinn, Phong, Lempart and so on. Each uses a different kind of calculations(shaders) to compute the lighting with the parameters the material is giving them.

So a material describes which shader to use and with which parameters.


#4831729 How to compile and execute Java program using Netbenas

Posted by Danny02 on 06 July 2011 - 05:35 AM

Just create a new project "with existing sources"(should be selectable in netbeans new project dialog.
There u can select the source files(all *.java files) and after u created the netbeans project go to the project preferences(rightclick on the project icon).
There u can add the jar found in the libary folder to the project libarys.

I just saw that the project is using Processing, it's an java visualisation framework. http://processing.org/
To run the project u have to include the processing libs also in your classpath(as aboth with the vitamin.jar)


#4830654 Basic Java Concepts

Posted by Danny02 on 03 July 2011 - 11:35 AM

normaly u won't need to pack your jar into a exe, because if a java runtime(JRE) is installed on a PC u can just start the JAR as any other app.

In the case where u don't know if your user have a valid JRE installed, or corretly configurated, u have to options.
The preferred one should be to use Java Webstart, it allows a user to "install" your application by clicking a link on a website. This approche makes sure that the user has a JRE installed and handle alot of other things too.

In the case that u want to do it a little more oldschool or just want to be able to send someone without internet your app. Wrapping your java app in a Exe Launcher is the best way.
For this case are a lot of free and comercial software out there. I use Launch4J cause its free and has a lot of configuration options.


#4822948 glEnableClientState and glDisableClientState, client and server

Posted by Danny02 on 13 June 2011 - 04:04 PM

When u talk about Client and Server in OpenGL, the Server is the GPU and the Client the CPU/driver.

These two commands are used for specifying vertex attributs. Take a look at the Vertex Arrays to see what this have to do with arrays.

The thing why u have to enable and disable stuff in OpenGL is, because the design of OpenGL based on states.
The two commands activate or deactivate the state of a specific vertex attribute, for example u want to render a model with and without a color attribute.


#4822888 drawElements vs drawArrays

Posted by Danny02 on 13 June 2011 - 01:41 PM

take a look at :
http://www.ozone3d.net/gpushark/

its from http://www.geeks3d.com/ which is also a very cool blog with interessting stuff(shader samples for example)


#4822751 drawElements vs drawArrays

Posted by Danny02 on 13 June 2011 - 08:06 AM

In 99% of all cases, using indices is better in every aspect.

Only in some rar cases u can save a few bytes of memory but it will probably be slower.
  • With VAOs u always have only one bind, so no advantage for drawArrays
  • when using indices u get the speed up of the post transform cach
  • when u have a standart 32byte vertex layout (4*(3+3+2)) u need less space with indices, if more then 6,25% of your vertices got used more then once. (using usigned short indices)

On of these rare cases would be rendering point spirits.



As Brother Bob explained very well, optimizing your OpenGL code depends on a lot of factors.




#4822714 Display list performance

Posted by Danny02 on 13 June 2011 - 05:59 AM

1. nowadays u should use VBO, because display lists are deprecated
2. your problem in this case is that u have so many draw calls and probably drawing always the trunk and branches of each tree instead of first only the trunks and then the branches,
try to render all trees in 1 display list


#4818923 Writing an easily maintainable, powerful and flexible particle system (new: e...

Posted by Danny02 on 02 June 2011 - 06:39 PM

GPUs only have 4 element data types. So u can use vec4 instead of your vec3 for free.


#4816103 Writing an easily maintainable, powerful and flexible particle system (new: e...

Posted by Danny02 on 26 May 2011 - 10:49 AM

u should get easily a few thousand particles on "normal" consumer hardware nowadays without much optimizations.


This let me believe that you have some kind of implementation problem instead of one in yourr concept


PS: with newer Hardware every kind of particle stuff should be calculated on the GPU, the only downside is that the implementation is probably more difficult.
So if u just want some basic particle stuff do it on the CPU, but if u want to go in the extremes(20mio particles or so) research about GPU particle systems.


#4813849 Real word to game world scale

Posted by Danny02 on 21 May 2011 - 07:41 AM

As said before, the scale of your system doesn't have to do anything with precision. You will always have problems with precision when dealing with great scale differences which have to be taken of.


#4813281 If/Else Statements in Swtich Statements?

Posted by Danny02 on 19 May 2011 - 08:05 PM

challenge accepted :-)

public static void main(String[] args) {
        String[] choices = new String[]{"Rock", "Paper", "Scissors"};
        System.out.println("What's your move?");
        for (int i = 0; i < 3; ++i)
            System.out.println("\t" + (1 + i) + ". " + choices[i]);
        Scanner in = new Scanner(System.in);
        int human = in.nextInt() - 1; //Get myMove
        int pc = (int) (3. * Math.random());//Get computerMove

        System.out.println("Computer chooses: " + choices[pc]);
        System.out.println("You choosed: " + choices[human]);

        int i = human - pc;
        if (pc == human)
            System.out.println("Tie!");
        else if (i == 1 || i == -2)
            System.out.println("You win!");
        else
            System.out.println("Computer wins!");
    }


for such a little programm a while loop will do, break out if the player don'T want to play another game.


ps: i nearly forgot, never ever compare two strings with ==. Always use the equals method or isEmpty.
a.equals("b") instead of a == "b"
a.isEmpty() instead of a == ""


#4812852 Real word to game world scale

Posted by Danny02 on 18 May 2011 - 08:33 PM

when using floating point numbers it really doesn't matter, you will always have the same amount of precision. So using 1.0 for 1 meter is just convenient to use, because you don't have to calculate how much meter 342 is when 1 meter is 4,7




PARTNERS