Jump to content

Gandi

Members
  • Posts

    295
  • Joined

  • Last visited

Posts posted by Gandi

  1. how what works?

     

    SetVertexNormal sets the Normal of a Vertex??

     

    TSurface is the surface of the model

    the integer says which Vertex you want to edit

    and the Vec3 is the Normal you assign.

  2. For waterfall particles may be a better solution (never tried it)

     

    for water, you will have to create your plane in the transparency world

    then there are 2 ways that come to my mind for texture animation.

     

    1) Always pass 2 textures to the shader. each representing a frame. then you blend those 2 textures according to the apptime. now you have to pass the right 2 textures from your code.

     

    2) just update the UV-coordinates in the shader.

     

    do you want to create realistic looking water, or a bit cartoonish style-water?

  3. Ok.. I managed it..

     

    if some1 is interested:

     

    #include <engine.h>
    #include <gl/gl.h>
    #include <gl/glu.h>
    
    namespace Clockwise
    {
    class LECustomWindow
    {
    	public:
    		LECustomWindow(HWND window);
    		TBuffer	GetBackBuffer();
    		int		GetWidth();
    		int		GetHeight();
    		virtual	void	SetSize(int width, int height);
    		void	Flip();
    	protected:
    		static void _stdcall		makeCurrent(void);
    		static void _stdcall		getSize(int* width, int* height);
    		TBuffer				BackBuffer;
    		TWorld				World;
    		int			Width;
    		int			Height;
    
    };
    }
    

     

    #include "LECustomWindow.h"
    #include <iostream>
    namespace Clockwise
    {
    HDC			hDC;
    HGLRC		hRC;
    
    void _stdcall LECustomWindow::makeCurrent(void)
    {
       wglMakeCurrent( hDC, hRC );
    }
    
    void _stdcall LECustomWindow::getSize(int* width, int* height)
    {
       makeCurrent();
       int vPort[4];
       glGetIntegerv(GL_VIEWPORT, vPort);
    
       *width = vPort[2];
       *height = vPort[3];
    }
    
    void	LECustomWindow::SetSize(int width, int height)
    {
    	Width=width;
    	Height=height;
    	glViewport(0,0,Width,Height);
    }
    
    LECustomWindow::LECustomWindow(HWND window)
    {
    	hDC=0;hRC=0;
    	PIXELFORMATDESCRIPTOR pfd;
    	int iFormat;
    
    	hDC = GetDC( window );
    	ZeroMemory( &pfd, sizeof( pfd ) );
    	pfd.nSize = sizeof( pfd );
    	pfd.nVersion = 1;
    	pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
    	pfd.iPixelType = PFD_TYPE_RGBA;
    	pfd.cColorBits = 32;
    	pfd.cAlphaBits = 8;
    	pfd.cDepthBits = 16;
    	pfd.iLayerType = PFD_MAIN_PLANE;
    
    	iFormat = ChoosePixelFormat( hDC, &pfd );
    	SetPixelFormat( hDC, iFormat, &pfd );
    	hRC = wglCreateContext( hDC );
    	wglMakeCurrent( hDC, hRC );
    	SetSize(800,600);
    	World = CreateWorld();
    	BackBuffer = CreateCustomBuffer((byte*)&getSize,(byte*)&makeCurrent);
    	SetBuffer(BackBuffer);
    	glEnable(GL_DEPTH_TEST);
    }
    
    TBuffer LECustomWindow::GetBackBuffer()
    {
    	return BackBuffer;
    }
    
    int LECustomWindow::GetWidth()
    {
    	return Width;
    }
    
    int LECustomWindow::GetHeight()
    {
    	return Height;
    }
    
    void	LECustomWindow::Flip()
    {
    	std::cout<<"FLIP"<<std::endl;
    	SwapBuffers(hDC);
    }
    }

     

    I know, i got some not really good stuff in the code, but i also had to play around a bit to get it to work..

  4. Is there a way of resizing the backbuffer without calling the Graphics() method?

     

    I would be also happy with some OpenGL commands for doing it..

     

    I just cant call Graphics() as this seems to create a ned HWND every time, and im using the window as a Child...

     

    I got no problem with resizing the rest of the buffers, but im really stuck with the backbuffer..

     

    if noone has a clue i guess, ill just make a backbuffer with screensize and rendering only the visible part, but thats not really the way I'd like to do it if not necessary

     

    €: I tried "glViewport(0, 0, width, height);" but that doesnt seem to do anything..

  5. I thought about creating some kind of tree-creator, which takes a model (created with the gmf-sdk) and the places the bones in the right position (forming the tree)

     

    now my question: how would i do the LOD best? i guess billboards wont work like that (the model are just vertices and bones placed at 0/0/0 as i place them at runtime)

    i guess making the LOD will be best if i create, for instance, 3 versions of each tree (each with less vertices then the one before) and then creating one billboard for each tree-type hoping this will not cause a too big graphical artifact..

     

    so to repeat:

    i got the modeler where i can define several parameters of the tree and which creates the .gmf file just containing rings of vertices with a bone (or 3 gmf files each with less vertices?)

    at runtime i place the bones according to the parameters i set at the modeller (for all 3 models?)

    then i create 1 tree for each type which i use for creating the billboard..

     

    does anyone have a better idea??

  6. Hi!

     

    I have a small mesh, which i scale/position in my shader.. works fine so far.. the problem is, that it doesnt get rendered if i dont look at the "original" position of the mesh (it doesnt take into account the position given in the shader). is there a way of turning of this disappearing-effect?

  7. Just wanted to ask if you are going to make some kind of tropical (or what would be even better: Oceania) plants package. I would buy instantly^^

    XFrog Plants Oceania seems to be the only good Oceania pack out there... so you would bridge a gap in the market :)

  8. Hi!

     

    I was thinkin about adding a new light type which also gets rendered in the render lights pass..

    now my question: is that even possible, or do i have to do it like some kind of post-process effect??

     

    i fear that it aint possible that easy, but it would really be better if i could use it as a light...

  9. i dont really know the water shader..

    but it also works this way:

    a shader with 2 textures and a float saving a value from 0.0-1.0.

     

    the shader now does the following:

    blending the two textures according to the value of the float.

     

    in your program you know have to set the textures and the float value..

    the textures are always the current and the next frame of the animation.

    the float value kinda is a modulo value which increases depending on the speed of the animation..

    this way you now should get smooth transitions between the frames of the animation

     

    like that:

    you want your texture (with 3 frames (tex1.dds, tex2.dds, tex3.dds)) to change every second.

     

    start:

    texture1 = tex1.dds

    texture2 = tex2.dds

    float = 0.0

     

    updating the float each frame until the time to the last framechange = 1 second, then:

    texture1 = tex2.dds

    texture2 = tex3.dds

    float = 0.0

     

    ......

     

    i think the caustics kinda work like that..

  10. I think things like mirrors will need a lot of performance..

     

    only thing i can think about is rendering the whole scene a second time, just using another camera (facing perpendicular to the surface of the mirror) rendering this scene to its own buffer and then applying the color-buffer to the mirror as a texture..

     

    but as you see, rendering everything a second time (for one mirror) will not be very performant..

     

    maybe there's a better way, but i dont know how..

  11. The leafs from some of the Dexsoft trees seem to have a black background instead of transparent. Is there something I need to do in the shader to make the background transparent for the leaf part of the texture? I notice the trunk and leaf are part of 1 texture file that the model uses, and the dds file is transparent.

     

    This is what my mat file looks like, maybe I'm doing something wrong here:

     

    texture0="abstract::oak1_c.dds"
    texture1="abstract::oak1_n.dds"
    
    blend=alpha
    
    shader="abstract::mesh_diffuse_bumpmap.vert","abstract::mesh_diffuse_bumpmap_specular.frag"
    

     

    that should also do it if you got the alpha channel used in the leaf texture..

    alphatest sometimes got rough edges as it just skips the pixel with an alpha lower a specific value (dont know how much this was atm)

  12. Hi!

    I'm trying to set the intensity of my directional light to a value < 1.0

     

    but it just doesnt seem to work..

    im using:

     

    EntityColor(sun, Vec4(1.0,1.0,1.0,0.0));
    

     

    but the light still gets rendered..

    is there any other way for doing it (and plz dont say: HideEntity as i want to fade it out slowly..)

  13. Hi!

    I tried to implement a sun-billboard into my project.. as i couödnt find anything else i tried the corona.. but it doesnt work the way i want it to..

    I want to set different appearance relative stuff in a shader.

    Im creating it like that:

     

    sun = CreateCorona();

    SetCoronaRadius(sun, 1,2);

    PaintEntity(sun, "abstract::sun.mat");

    PositionEntity(sun,Vec3(1,0,0));

    so i checked the corona.frag shader.. this one was pretty confusing.. (why do you set the color at gl_FragData[3]. usually you use gl_FragData[0]..)

     

    my problems: if u just set the color in the frag shader its a black rectangle showing up.. also there is a little clipping problem as the corona disapperas when the center of it inst in the screen anymore..

     

    hope some1 can help me..

    Gandi

×
×
  • Create New...