• Content count

  • Joined

  • Last visited

Community Reputation

132 Neutral

About renanrosa

  • Rank
  1. Many shaders GLSL in scenes

    Did not work Remained only the first You have to set your depth-compare so that drawing the same model more than once passes the depth test each time (and similarly for any stenciling tests). The first pass typically uses GL_LESS (or GL_LEQUAL), and following passes use GL_EQUAL. L. Spiro Can you show to me? with source-code example.
  2. DirectX with Qt

    Quote:Original post by alliedwarrior Quote:Original post by the_edd But do you actually try to *create* a Test object? No, I did the test now and I created the object, and received the same error [crying] my .pro Quote:<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns=""> <ImportGroup Label="PropertySheets" /> <PropertyGroup Label="UserMacros"> <QTDIR>C:\Qt\4.7.1</QTDIR> </PropertyGroup> <PropertyGroup /> <ItemDefinitionGroup /> <ItemGroup> <BuildMacro Include="QTDIR"> <Value>$(QTDIR)</Value> <EnvironmentVariable>true</EnvironmentVariable> </BuildMacro> </ItemGroup> </Project> Hi AlliedWarrior, here has a member called VitaliBR he know much QT, send u a PM. :D hugs
  3. Texture Alpha Fade

    Hi Buckeye See my code: const DWORD dwCustomFVF = (D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1); struct SimpleVertex { float x,y,z; DWORD diffuse; float u,v; }; //wall SimpleVertex parede[4] = { { -1.0f, 1.0f, 3.0f, 0, 0,0 }, { -1.0f, -1.0f, 3.0f, 0, 0,1 }, { 1.0f, 1.0f, 3.0f, 0, 1,0 }, { 1.0f, -1.0f, 3.0f, 0, 1,1 }, }; //object alpha SimpleVertex Vertices[4] = { { -1.0f, 1.0f, 3.0f, 0, 0,0 }, { -1.0f, -1.0f, 3.0f, 0, 0,1 }, { 1.0f, 1.0f, 3.0f, 0, 1,0 }, { 1.0f, -1.0f, 3.0f, 0, 1,1 }, }; //configure all and load texture void AdjustStates() { g_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE ); g_pd3dDevice->SetRenderState( D3DRS_LIGHTING, FALSE ); g_pd3dDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_TRUE ); g_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA ); g_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_DESTALPHA ); g_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); g_pd3dDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); g_pd3dDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); g_pd3dDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR); D3DXMATRIX matProj; D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI/4, 1.5f, 1.0f, 100.0f ); g_pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj ); //create texture D3DXCreateTextureFromFile( g_pd3dDevice, L"textura.jpg", &texturaAlpha); D3DXCreateTextureFromFile( g_pd3dDevice, L"parede.jpg", &texturaWall ); } //draw wall void drawParede() { g_pd3dDevice->SetFVF(D3DFVF_TEX1); SetPosition(200,200,20); g_pd3dDevice->SetTexture(0, texturaWall ); g_pd3dDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, parede, sizeof(SimpleVertex) ); } void Render() { g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(150,150,150), 1.0f, 0 ); if( SUCCEEDED( g_pd3dDevice->BeginScene() ) ) { drawParede(); SetPosition(1,1,1); g_pd3dDevice->SetFVF(dwCustomFVF); DWORD alpha = 255 * max (0, timeGetTime() / 15); for(int i = 0; i < 4; ++i) { //only alpha dont work Vertices[i].diffuse = D3DCOLOR_ARGB(alpha, alpha, alpha, alpha); } g_pd3dDevice->SetTexture(0, texturaAlpha); g_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE ); g_pd3dDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, Vertices, sizeof(SimpleVertex) ); g_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE); g_pd3dDevice->EndScene(); } g_pd3dDevice->Present( NULL, NULL, NULL, NULL ); }
  4. Texture Alpha Fade

    Quote:Original post by programci_84 Quote:hi, thank, worked, but only changing the color and not the alpha: for(int i=0; i < 4 ; i++) { vtxBillBoard[i].colour = D3DCOLOR_ARGB(100, rand()%256, rand()%256, rand()%256); } why ? Look at your code: You're using ARGB and setting .a (alpha) parameter to 100. This means that alpha value will be constant. Every frame, try changing .a parameter. Like one guy suggested: *** Source Snippet Removed *** sure, I understood, is working perfectly, but if I change just the alpha does not work, I have to change the color too, regardless if I change the alpha value. but how I do it in a mesh? (.x File)
  5. Texture Alpha Fade

    Quote:Original post by Adam_42 Try something like this: *** Source Snippet Removed *** You might also find useful. hi, thank, worked, but only changing the color and not the alpha: for(int i=0; i < 4 ; i++) { vtxBillBoard[i].colour = D3DCOLOR_ARGB(100, rand()%256, rand()%256, rand()%256); } why ?
  6. Texture Alpha Fade

    Quote:Original post by unbird For instance linear (pseuso code):color.a = color.a * max(0, (1 - time / duration));Where time is the particle's current lifetime (a variable) and duration is the time needed to fully fade out the particle (a constant). but how i access the color of the vertex ? (pseuso code): ID3DXMesh* mesh; loadXFile(&mesh, "xFile.x"); ........ //configure alpha ........ g_pDevice->setTexture(0, text); // how mesh->getColor ?? mesh->DrawSubset(0); or struct VERTEX { enum { FVF = D3DFVF_XYZ | D3DFVF_TEX1 }; //D3DFVF_DIFFUSE float px, py, pz; float tu, tv; }; //create the vertex VERTEX vtxBillBoard[4] = { { -1, 0, 0, 0, 1 }, { -1, 4, 0, 0, 0 }, { 1, 0, 0, 1, 1 }, { 1, 4, 0, 1, 0 } }; g_pd3dDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, vtxBillBoard, sizeof(VERTEX) );
  7. Texture Alpha Fade

    Quote:Original post by Buckeye Assuming you're using a shader and have parameters set as below, decrease the vertex color alpha over time. AlphaBlendEnable = true; // alpha blending SrcBlend = SrcAlpha; DestBlend = InvSrcAlpha; ZWriteEnable = false; but how decrease the color of the vertex ?
  8. Hi Guys, how to set a level of transparency gradually ? as a smoke that will disappear at the end. example:
  9. Channel Alpha (Render State)

    burrinho, pergunta-se antes pra mim, faz assim, crie uma função/metodo: //liga pra renderiza e depois seta false void buffer(bool buffer) { if(buffer) { g_pd3dDevice-&gt;SetRenderState( D3DRS_ZWRITEENABLE, FALSE ); g_pd3dDevice-&gt;SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE ); g_pd3dDevice-&gt;SetRenderState( D3DRS_DESTBLEND, D3DBLEND_ONE ); // configura o estado do render pra usar o point sprites... g_pd3dDevice-&gt;SetRenderState( D3DRS_POINTSPRITEENABLE, TRUE ); g_pd3dDevice-&gt;SetRenderState( D3DRS_POINTSCALEENABLE, TRUE ); } else { g_pd3dDevice-&gt;SetRenderState( D3DRS_POINTSPRITEENABLE, FALSE ); g_pd3dDevice-&gt;SetRenderState( D3DRS_POINTSCALEENABLE, FALSE ); g_pd3dDevice-&gt;SetRenderState( D3DRS_ZWRITEENABLE, TRUE ); g_pd3dDevice-&gt;SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE ); } } ai pra usar, você coloca antes de renderizar a textura que tem o alpha: buffer(true); arvore-&gt;renderiza(); buffer(false);
  10. how do I use more than one shader?

    Quote:Original post by jpetrie Quote: how ? By authoring them as composed effects. If you used to have EffectA and EffectB, you instead write one EffectC that does what EffectA and EffectB both did. sorry, i dont understand, have a example code ?
  11. how do I use more than one shader?

    Quote:Original post by Tubos BTW, what does your BlurEffect do? nothing, i just quoted as an example :D. Quote:Original post by Tubos If you want multiple effects, you have to combine them yourself into one shader. how ?
  12. how do I use more than one shader?

    Excuse me guys, but I want to know: i have the models: ground, house and a tree i want render it with shader. Example: configAllEfect(); //config all effect (texture, matrix, etc..) BlurEffect->begin(); LightEffect->begin(); BMEffect->begin(); groundMeshX->drawSubSet(0); houseMeshX->drawSubSet(0); treeMeshX->drawSubSet(0); BlurEffect->end(); LightEffect->end(); BMEffect->end(); how ?
  13. how do I use more than one shader?

    Hi G'luck, i have many fx shaders HLSL (1 light.fx, 2 blur.fx, 3 bump mapping.fx ) my models is opaque, i'm using DX9 and C++ vertex cache manager ? no
  14. Hi peoples, how do I use more than one shader? example: I have shader (many HLSL) shadow, light, blur effect, normal mapping etc. and how can i use all in one model?
  15. Quote:Original post by LancerSolurus What it sounds like is happening is that the next shader is writing over the previous shader's render. Since you didn't mention using render targets, I'm assuming you are rendering everything to the back buffer. I recently ran into this exact problem and came up with a fix that works great... What I did was create 2 different types of passes, one for the first pass and the rest for any following pass. The first pass will include all of your standard settings for the states. The second pass turns off ZWriteEnable (so it won't z-fail on 2n passes) and turned on AlphaBlendEnable with SrcBlend & DestBlend set to 'one'. This will allow the next pass(es) to be blended directly into the previous render without z-fighting. DBXShader is used the first pass and DBXShader_NW is used for subsequent passes. *** Source Snippet Removed *** There are probably many better ways of doing it but this one works fine for me. did not work :( more idea?