Changeset 1672 for GTP/trunk/App/Demos
- Timestamp:
- 10/24/06 08:38:56 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Illum/EnvMap
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/EnvMap/.matrix
r1574 r1672 1 1 2 2 World matrix: 3 0.9 135 0.2775 -0.297504 -0.2198 0.952 0.213205 0.3424 -0.1293 0.930606 0 5.96e-008 2.39913 0.9997 -0.01646 -0.01694 0 4 0.01642 0.9999 -0.0024 0 5 0.01698 0.002121 0.9999 0 6 0 0 5.524 1 7 7 8 8 Camera position: 9 0.713843 -0.51149 -2.232779 0.0935908 0.0132558 -5.52339 10 10 11 11 Mesh position: 12 -0. 331426 0.385354 1.3221512 -0.166667 0 0 -
GTP/trunk/App/Demos/Illum/EnvMap/.params
r1574 r1672 1 1 47 version ----- RayTraceEffects: Saved parameters of the algorithm ----- 2 2 Bool values: 3 00 013 0011 4 4 (Help [F1]; [F]ireballs; Multiple [O]bjects; Between [W]alls only; ) 5 5 Float values: 6 6 3 (WhichMethod [TAB,Q], 0..4) 7 7(WhichMesh [Home,End], 0..9)8 30(Mesh size [Ins,Del], 0..100)7 8 (WhichMesh [Home,End], 0..9) 8 27 (Mesh size [Ins,Del], 0..100) 9 9 1 (Resolution [M], 0..3) 10 10 0 (ShowCubeMap [C], 0..3) -
GTP/trunk/App/Demos/Illum/EnvMap/EnvMap.cpp
r1574 r1672 297 297 case DIFFUSE_SPECULAR_LOCALIZED_5TEX: 298 298 V( g_pEffect->SetTechnique( "EnvMapDiffuseLocalized5Tex" ) ); 299 break; 300 case DIFFUSE_SPECULAR_LOCALIZED_ADAPT: 301 V( g_pEffect->SetTechnique( "EnvMapDiffuseAdapt" ) ); 299 302 break; 300 303 } -
GTP/trunk/App/Demos/Illum/EnvMap/EnvMap.fx
r1575 r1672 532 532 float d; 533 533 534 for (float x = 0 .5; x < M; x++)535 for (float y = 0 .5; y < M; y++)534 for (float x = 0; x < M; x++) 535 for (float y = 0; y < M; y++) 536 536 { 537 537 float2 p, tpos; … … 542 542 p = 2.0 * p - 1.0; //-1..1 543 543 544 L1 = float3(p.x - width, p.y - width, 1);545 L2 = float3(p.x + width , p.y - width, 1);546 L3 = float3(p.x + width , p.y + width, 1);547 L4 = float3(p.x - width, p.y + width, 1);548 L = float3(p.x , p.y, 1);544 L1 = float3(p.x, p.y, 1); 545 L2 = float3(p.x + width2, p.y, 1); 546 L3 = float3(p.x + width2, p.y + width2, 1); 547 L4 = float3(p.x, p.y + width2, 1); 548 L = float3(p.x + width, p.y + width, 1); 549 549 Le = float4(texCUBE(SmallEnvironmentMapSampler, L).rgb, 1); 550 550 … … 553 553 } 554 554 555 for (float x = 0 .5; x < M; x++)556 for (float y = 0 .5; y < M; y++)555 for (float x = 0; x < M; x++) 556 for (float y = 0; y < M; y++) 557 557 { 558 558 float2 p, tpos; … … 563 563 p = 2.0 * p - 1.0; //-1..1 564 564 565 L4 = float3(p.x - width, p.y - width, -1);566 L3 = float3(p.x + width , p.y - width, -1);567 L2 = float3(p.x + width , p.y + width, -1);568 L1 = float3(p.x - width, p.y + width, -1);569 L = float3(p.x , p.y, -1);565 L4 = float3(p.x, p.y, -1); 566 L3 = float3(p.x + width2, p.y, -1); 567 L2 = float3(p.x + width2, p.y + width2, -1); 568 L1 = float3(p.x, p.y + width2, -1); 569 L = float3(p.x + width, p.y + width, -1); 570 570 Le = float4(texCUBE(SmallEnvironmentMapSampler, L).rgb, 1); 571 571 … … 573 573 } 574 574 575 for (float x = 0 .5; x < M; x++)576 for (float y = 0 .5; y < M; y++)575 for (float x = 0; x < M; x++) 576 for (float y = 0; y < M; y++) 577 577 { 578 578 float2 p, tpos; … … 583 583 p = 2.0 * p - 1.0; //-1..1 584 584 585 L4 = float3(p.x - width, 1, p.y - width);586 L3 = float3(p.x + width , 1, p.y - width);587 L2 = float3(p.x + width , 1, p.y + width);588 L1 = float3(p.x - width, 1, p.y + width);589 L = float3(p.x , 1, p.y);585 L4 = float3(p.x, 1, p.y); 586 L3 = float3(p.x + width2, 1, p.y); 587 L2 = float3(p.x + width2, 1, p.y + width2); 588 L1 = float3(p.x, 1, p.y + width2); 589 L = float3(p.x + width, 1, p.y + width); 590 590 Le = float4(texCUBE(SmallEnvironmentMapSampler, L).rgb, 1); 591 591 … … 593 593 } 594 594 595 for (float x = 0 .5; x < M; x++)596 for (float y = 0 .5; y < M; y++)595 for (float x = 0; x < M; x++) 596 for (float y = 0; y < M; y++) 597 597 { 598 598 float2 p, tpos; … … 603 603 p = 2.0 * p - 1.0; //-1..1 604 604 605 L1 = float3(p.x - width, -1, p.y - width);606 L2 = float3(p.x + width , -1, p.y - width);607 L3 = float3(p.x + width , -1, p.y + width);608 L4 = float3(p.x - width, -1, p.y + width);609 L = float3(p.x , -1, p.y);605 L1 = float3(p.x, -1, p.y); 606 L2 = float3(p.x + width2, -1, p.y); 607 L3 = float3(p.x + width2, -1, p.y + width2); 608 L4 = float3(p.x, -1, p.y + width2); 609 L = float3(p.x + width, -1, p.y + width); 610 610 Le = float4(texCUBE(SmallEnvironmentMapSampler, L).rgb, 1); 611 611 … … 613 613 } 614 614 615 for (float x = 0 .5; x < M; x++)616 for (float y = 0 .5; y < M; y++)615 for (float x = 0; x < M; x++) 616 for (float y = 0; y < M; y++) 617 617 { 618 618 float2 p, tpos; … … 623 623 p = 2.0 * p - 1.0; //-1..1 624 624 625 L1 = float3(1, p.x - width, p.y - width);626 L2 = float3(1, p.x + width , p.y - width);627 L3 = float3(1, p.x + width , p.y + width);628 L4 = float3(1, p.x - width, p.y + width);629 L = float3(1, p.x , p.y);625 L1 = float3(1, p.x, p.y); 626 L2 = float3(1, p.x + width2, p.y); 627 L3 = float3(1, p.x + width2, p.y + width2); 628 L4 = float3(1, p.x, p.y + width2); 629 L = float3(1, p.x + width, p.y + width); 630 630 Le = float4(texCUBE(SmallEnvironmentMapSampler, L).rgb, 1); 631 631 … … 633 633 } 634 634 635 for (float x = 0 .5; x < M; x++)636 for (float y = 0 .5; y < M; y++)635 for (float x = 0; x < M; x++) 636 for (float y = 0; y < M; y++) 637 637 { 638 638 float2 p, tpos; … … 643 643 p = 2.0 * p - 1.0; //-1..1 644 644 645 L4 = float3(-1, p.x - width, p.y - width);646 L3 = float3(-1, p.x + width , p.y - width);647 L2 = float3(-1, p.x + width , p.y + width);648 L1 = float3(-1, p.x - width, p.y + width);649 L = float3(-1, p.x , p.y);645 L4 = float3(-1, p.x, p.y); 646 L3 = float3(-1, p.x + width2, p.y); 647 L2 = float3(-1, p.x + width2, p.y + width2); 648 L1 = float3(-1, p.x, p.y + width2); 649 L = float3(-1, p.x + width, p.y + width); 650 650 Le = float4(texCUBE(SmallEnvironmentMapSampler, L).rgb, 1); 651 651 … … 706 706 } 707 707 708 return intensity * I; 709 } 710 711 float4 EnvMapDiffuseAdaptPS( _EnvMapVS_output IN ) : COLOR 712 { 713 float M = 4.0; 714 IN.View = -normalize( IN.View ); 715 IN.Normal = normalize( IN.Normal ); 716 IN.Position -= reference_pos.xyz; 717 float3 pos = IN.Position.xyz; 718 719 //return reference_pos; 720 //return texCUBE(SmallEnvironmentMapSampler, pos); 721 722 float3 N =IN.Normal; 723 float3 R = -reflect( IN.View, IN.Normal ); 724 725 float4 I = 0; 726 float3 L1, L2, L3, L4, L; 727 float4 Le; 728 float Ld; 729 float width = 1.0 / M; 730 float width2 = width * 2; 731 float d; 732 733 for (float x = 0; x < M; x++) 734 for (float y = 0; y < M; y++) 735 { 736 float2 p, tpos; 737 tpos.x = x * width; 738 tpos.y = y * width; 739 740 p = tpos.xy; 741 p = 2.0 * p - 1.0; //-1..1 742 743 L = float3(p.x + width, p.y + width, 1); 744 Ld = texCUBE(SmallEnvironmentMapSampler, L).a; 745 746 float dist = length(normalize(L) * Ld - pos); 747 if(dist < 1.0) 748 { 749 L1 = float3(p.x, p.y, 1); 750 L2 = float3(p.x + width2, p.y, 1); 751 L3 = float3(p.x + width2, p.y + width2, 1); 752 L4 = float3(p.x, p.y + width2, 1); 753 Le = float4(texCUBE(SmallEnvironmentMapSampler, L).rgb, 1); 754 755 I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, SmallEnvironmentMapSampler); 756 } 757 else 758 I += P2PContr(N, float3(0,0,-1), pos, L, SmallEnvironmentMapSampler); 759 760 } 761 762 for (float x = 0; x < M; x++) 763 for (float y = 0; y < M; y++) 764 { 765 float2 p, tpos; 766 tpos.x = x * width; // 0..1 767 tpos.y = y * width; // 0..1 768 769 p = tpos.xy; 770 p = 2.0 * p - 1.0; //-1..1 771 772 L = float3(p.x + width, p.y + width, -1); 773 Ld = texCUBE(SmallEnvironmentMapSampler, L).a; 774 775 float dist = length(normalize(L) * Ld - pos); 776 if(dist < 1.0) 777 { 778 L4 = float3(p.x, p.y, -1); 779 L3 = float3(p.x + width2, p.y, -1); 780 L2 = float3(p.x + width2, p.y + width2, -1); 781 L1 = float3(p.x, p.y + width2, -1); 782 Le = float4(texCUBE(SmallEnvironmentMapSampler, L).rgb, 1); 783 784 I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, SmallEnvironmentMapSampler); 785 } 786 else 787 I += P2PContr(N, float3(0,0,1), pos, L, SmallEnvironmentMapSampler); 788 } 789 790 for (float x = 0; x < M; x++) 791 for (float y = 0; y < M; y++) 792 { 793 float2 p, tpos; 794 tpos.x = x * width; // 0..1 795 tpos.y = y * width; // 0..1 796 797 p = tpos.xy; 798 p = 2.0 * p - 1.0; //-1..1 799 800 L = float3(p.x + width, 1, p.y + width); 801 Ld = texCUBE(SmallEnvironmentMapSampler, L).a; 802 803 float dist = length(normalize(L) * Ld - pos); 804 if(dist < 1.0) 805 { 806 L4 = float3(p.x, 1, p.y); 807 L3 = float3(p.x + width2, 1, p.y); 808 L2 = float3(p.x + width2, 1, p.y + width2); 809 L1 = float3(p.x, 1, p.y + width2); 810 Le = float4(texCUBE(SmallEnvironmentMapSampler, L).rgb, 1); 811 812 I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, SmallEnvironmentMapSampler); 813 } 814 else 815 I += P2PContr(N, float3(0,-1,0), pos, L, SmallEnvironmentMapSampler); 816 817 } 818 819 for (float x = 0; x < M; x++) 820 for (float y = 0; y < M; y++) 821 { 822 float2 p, tpos; 823 tpos.x = x * width; // 0..1 824 tpos.y = y * width; // 0..1 825 826 p = tpos.xy; 827 p = 2.0 * p - 1.0; //-1..1 828 829 L = float3(p.x + width, -1, p.y + width); 830 Ld = texCUBE(SmallEnvironmentMapSampler, L).a; 831 832 float dist = length(normalize(L) * Ld - pos); 833 if(dist < 1.0) 834 { 835 L1 = float3(p.x, -1, p.y); 836 L2 = float3(p.x + width2, -1, p.y); 837 L3 = float3(p.x + width2, -1, p.y + width2); 838 L4 = float3(p.x, -1, p.y + width2); 839 Le = float4(texCUBE(SmallEnvironmentMapSampler, L).rgb, 1); 840 841 I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, SmallEnvironmentMapSampler); 842 } 843 else 844 I += P2PContr(N, float3(0,1,0), pos, L, SmallEnvironmentMapSampler); 845 846 } 847 848 for (float x = 0; x < M; x++) 849 for (float y = 0; y < M; y++) 850 { 851 float2 p, tpos; 852 tpos.x = x * width; // 0..1 853 tpos.y = y * width; // 0..1 854 855 p = tpos.xy; 856 p = 2.0 * p - 1.0; //-1..1 857 858 L = float3(1, p.x + width, p.y + width); 859 Ld = texCUBE(SmallEnvironmentMapSampler, L).a; 860 float dist = length(normalize(L) * Ld - pos); 861 if(dist < 1.0) 862 { 863 L1 = float3(1, p.x, p.y); 864 L2 = float3(1, p.x + width2, p.y); 865 L3 = float3(1, p.x + width2, p.y + width2); 866 L4 = float3(1, p.x, p.y + width2); 867 Le = float4(texCUBE(SmallEnvironmentMapSampler, L).rgb, 1); 868 869 I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, SmallEnvironmentMapSampler); 870 } 871 else 872 I += P2PContr(N, float3(-1,0,0), pos, L, SmallEnvironmentMapSampler); 873 874 } 875 876 for (float x = 0; x < M; x++) 877 for (float y = 0; y < M; y++) 878 { 879 float2 p, tpos; 880 tpos.x = x * width; // 0..1 881 tpos.y = y * width; // 0..1 882 883 p = tpos.xy; 884 p = 2.0 * p - 1.0; //-1..1 885 886 L = float3(-1, p.x + width, p.y + width); 887 Ld = texCUBE(SmallEnvironmentMapSampler, L).a; 888 float dist = length(normalize(L) * Ld - pos); 889 if(dist < 1.0) 890 { 891 L4 = float3(-1, p.x, p.y); 892 L3 = float3(-1, p.x + width2, p.y); 893 L2 = float3(-1, p.x + width2, p.y + width2); 894 L1 = float3(-1, p.x, p.y + width2); 895 Le = float4(texCUBE(SmallEnvironmentMapSampler, L).rgb, 1); 896 897 I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, SmallEnvironmentMapSampler); 898 899 } 900 else 901 I += P2PContr(N, float3(1,0,0), pos, L, SmallEnvironmentMapSampler); 902 } 708 903 return intensity * I; 709 904 } … … 806 1001 TechniqueUsingCommonVS( EnvMapDiffuseLocalizedNew ); 807 1002 TechniqueUsingCommonVS( EnvMapDiffuseP2P ); 808 //TechniqueUsingCommonVS( EnvMapDiffuseLocalizedNew4 ); 809 //TechniqueUsingCommonVS( EnvMapDiffuseLocalizedNew8 ); 810 //TechniqueUsingCommonVS( EnvMapDiffuseLocalizedNew16 ); 1003 TechniqueUsingCommonVS( EnvMapDiffuseAdapt ); 811 1004 812 1005 #define ReduceTextureTechnique(M); \ -
GTP/trunk/App/Demos/Illum/EnvMap/Main.cpp
r1573 r1672 199 199 200 200 // SLIDERS 201 pp.Add( iWhichMethod, "WhichMethod [TAB,Q]", 4, VK_TAB, 'Q', noconvert, OnChangeCubeMap );201 pp.Add( iWhichMethod, "WhichMethod [TAB,Q]", 5, VK_TAB, 'Q', noconvert, OnChangeCubeMap ); 202 202 pp.Add( iWhichMesh, "WhichMesh [Home,End]", 9, VK_HOME, VK_END, noconvert, OnChangeMesh ); 203 203 pp.Add( fMeshScale, "Mesh size [Ins,Del]", 100, VK_DELETE, VK_INSERT, noconvert, OnChangeMeshSize ); … … 305 305 #endif 306 306 307 dwShaderFlags |= D3DXSHADER_SKIPOPTIMIZATION;307 //dwShaderFlags |= D3DXSHADER_SKIPOPTIMIZATION; 308 308 309 309 // ----------- compiling fx file ----------- -
GTP/trunk/App/Demos/Illum/EnvMap/Mesh.cpp
r1488 r1672 110 110 exit(-1); 111 111 } 112 // if(fileName == L"Media\\Objects\\bunny.x") 113 // D3DXSaveMeshToX(L"bunnyasc.x",pMesh,NULL,NULL,NULL,0,D3DXF_FILEFORMAT_TEXT); 112 114 113 115 if ( FAILED( CalculateMeshSize() )) -
GTP/trunk/App/Demos/Illum/EnvMap/Parameters.h
r1573 r1672 14 14 /// Possible values for #iWhichMethod. 15 15 typedef enum { 16 DIFFUSE_SPECULAR_CLASSIC, ///< Classic environment mapping technique.17 DIFFUSE_SPECULAR_LOCALIZED, ///< Our proposal.16 DIFFUSE_SPECULAR_CLASSIC, ///< Classic environment mapping technique. 17 DIFFUSE_SPECULAR_LOCALIZED, ///< Our proposal. 18 18 DIFFUSE_SPECULAR_LOCALIZED_5TEX, ///< Our proposal, using 5 texel only. 19 19 DIFFUSE_SPECULAR_LOCALIZED_NEW, ///< Our proposal. 20 DIFFUSE_SPECULAR_LOCALIZED_P2P ///< Point to point form factor 20 DIFFUSE_SPECULAR_LOCALIZED_P2P, ///< Point to point form factor 21 DIFFUSE_SPECULAR_LOCALIZED_ADAPT ///< Point to point form factor 21 22 } method_t; 22 23
Note: See TracChangeset
for help on using the changeset viewer.