<?xml version="1.0" encoding="utf-8"?>
<!--Generated by DFIN XBRL Instance Document - http://www.dfinsolutions.com/ - Version R3.0 - on 04-August-2022 [07:25:31] {AM}-->
<schema targetNamespace="http://www.trex.com/20220630" elementFormDefault="qualified" xmlns:trex="http://www.trex.com/20220630" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xbrli="http://www.xbrl.org/2003/instance" xmlns:xbrldt="http://xbrl.org/2005/xbrldt" xmlns:xl="http://www.xbrl.org/2003/XLink" xmlns:us-gaap="http://fasb.org/us-gaap/2022" xmlns:country="http://xbrl.sec.gov/country/2022" xmlns:currency="http://xbrl.sec.gov/currency/2022" xmlns:dei="http://xbrl.sec.gov/dei/2022" xmlns:exch="http://xbrl.sec.gov/exch/2022" xmlns:naics="http://xbrl.sec.gov/naics/2022" xmlns:sic="http://xbrl.sec.gov/sic/2022" xmlns:us-types="http://fasb.org/us-types/2022" xmlns:stpr="http://xbrl.sec.gov/stpr/2022" xmlns:deprecated="http://www.xbrl.org/2009/arcrole/fact-explanatoryFact" xmlns:srt="http://fasb.org/srt/2022" xmlns:srt-types="http://fasb.org/srt-types/2022" xmlns:dtr-types="http://www.xbrl.org/dtr/type/2020-01-21">
<annotation>
<appinfo>
<link:roleType roleURI="http://www.trex.com/role/CoverPage" id="CoverPage">
<link:definition>1001 - Document - Cover Page</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/CondensedConsolidatedStatementsOfComprehensiveIncome" id="CondensedConsolidatedStatementsOfComprehensiveIncome">
<link:definition>1002 - Statement - Condensed Consolidated Statements of Comprehensive Income</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/CondensedConsolidatedBalanceSheets" id="CondensedConsolidatedBalanceSheets">
<link:definition>1003 - Statement - Condensed Consolidated Balance Sheets</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/CondensedConsolidatedBalanceSheetsParenthetical" id="CondensedConsolidatedBalanceSheetsParenthetical">
<link:definition>1004 - Statement - Condensed Consolidated Balance Sheets (Parenthetical)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/CondensedConsolidatedStatementsOfChangesInStockholdersEquity" id="CondensedConsolidatedStatementsOfChangesInStockholdersEquity">
<link:definition>1005 - Statement - Condensed Consolidated Statements of Changes in Stockholders' Equity</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/CondensedConsolidatedStatementsOfCashFlows" id="CondensedConsolidatedStatementsOfCashFlows">
<link:definition>1006 - Statement - Condensed Consolidated Statements of Cash Flows</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/BusinessAndOrganization" id="BusinessAndOrganization">
<link:definition>1007 - Disclosure - Business and Organization</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/BasisOfPresentation" id="BasisOfPresentation">
<link:definition>1008 - Disclosure - Basis of Presentation</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/RecentlyAdoptedAccountingStandards" id="RecentlyAdoptedAccountingStandards">
<link:definition>1009 - Disclosure - Recently Adopted Accounting Standards</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/NewAccountingStandardsNotYetAdopted" id="NewAccountingStandardsNotYetAdopted">
<link:definition>1010 - Disclosure - New Accounting Standards Not Yet Adopted</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/Inventories" id="Inventories">
<link:definition>1011 - Disclosure - Inventories</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/PrepaidExpensesAndOtherAssets" id="PrepaidExpensesAndOtherAssets">
<link:definition>1012 - Disclosure - Prepaid Expenses and Other Assets</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/GoodwillAndOtherIntangibleAssetsNet" id="GoodwillAndOtherIntangibleAssetsNet">
<link:definition>1013 - Disclosure - Goodwill and Other Intangible Assets, Net</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/AccruedExpensesAndOtherLiabilities" id="AccruedExpensesAndOtherLiabilities">
<link:definition>1014 - Disclosure - Accrued Expenses and Other Liabilities</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/Debt" id="Debt">
<link:definition>1015 - Disclosure - Debt</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/Leases" id="Leases">
<link:definition>1016 - Disclosure - Leases</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/FinancialInstruments" id="FinancialInstruments">
<link:definition>1017 - Disclosure - Financial Instruments</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/StockholdersEquity" id="StockholdersEquity">
<link:definition>1018 - Disclosure - Stockholders' Equity</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/RevenueFromContractsWithCustomers" id="RevenueFromContractsWithCustomers">
<link:definition>1019 - Disclosure - Revenue From Contracts With Customers</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/StockBasedCompensation" id="StockBasedCompensation">
<link:definition>1020 - Disclosure - Stock-Based Compensation</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/IncomeTaxes" id="IncomeTaxes">
<link:definition>1021 - Disclosure - Income Taxes</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/SegmentInformation" id="SegmentInformation">
<link:definition>1022 - Disclosure - Segment Information</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/Seasonality" id="Seasonality">
<link:definition>1023 - Disclosure - Seasonality</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/CommitmentsAndContingencies" id="CommitmentsAndContingencies">
<link:definition>1024 - Disclosure - Commitments and Contingencies</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/SummaryOfSignificantAccountingPoliciesPolicies" id="SummaryOfSignificantAccountingPoliciesPolicies">
<link:definition>1025 - Disclosure - Summary of Significant Accounting Policies (Policies)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/InventoriesTables" id="InventoriesTables">
<link:definition>1026 - Disclosure - Inventories (Tables)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/PrepaidExpensesAndOtherAssetsTables" id="PrepaidExpensesAndOtherAssetsTables">
<link:definition>1027 - Disclosure - Prepaid Expenses and Other Assets (Tables)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/AccruedExpensesAndOtherLiabilitiesTables" id="AccruedExpensesAndOtherLiabilitiesTables">
<link:definition>1028 - Disclosure - Accrued Expenses and Other Liabilities (Tables)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/LeasesTables" id="LeasesTables">
<link:definition>1029 - Disclosure - Leases (Tables)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/StockholdersEquityTables" id="StockholdersEquityTables">
<link:definition>1030 - Disclosure - Stockholders' Equity (Tables)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/RevenueFromContractsWithCustomersTables" id="RevenueFromContractsWithCustomersTables">
<link:definition>1031 - Disclosure - Revenue From Contracts With Customers (Tables)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/StockBasedCompensationTables" id="StockBasedCompensationTables">
<link:definition>1032 - Disclosure - Stock-Based Compensation (Tables)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/SegmentInformationTables" id="SegmentInformationTables">
<link:definition>1033 - Disclosure - Segment Information (Tables)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/CommitmentsAndContingenciesTables" id="CommitmentsAndContingenciesTables">
<link:definition>1034 - Disclosure - Commitments and Contingencies (Tables)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/BusinessAndOrganizationAdditionalInformationDetail" id="BusinessAndOrganizationAdditionalInformationDetail">
<link:definition>1035 - Disclosure - Business and Organization - Additional Information (Detail)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/InventoriesSummaryOfInventoriesDetail" id="InventoriesSummaryOfInventoriesDetail">
<link:definition>1036 - Disclosure - Inventories - Summary of Inventories (Detail)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/InventoriesAdditionalInformationDetail" id="InventoriesAdditionalInformationDetail">
<link:definition>1037 - Disclosure - Inventories - Additional Information (Detail)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/PrepaidExpensesAndOtherAssetsSummaryOfPrepaidExpensesAndOtherAssetsDetail" id="PrepaidExpensesAndOtherAssetsSummaryOfPrepaidExpensesAndOtherAssetsDetail">
<link:definition>1038 - Disclosure - Prepaid Expenses and Other Assets - Summary of Prepaid Expenses and Other Assets (Detail)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/GoodwillAndOtherIntangibleAssetsNetAdditionalInformationDetail" id="GoodwillAndOtherIntangibleAssetsNetAdditionalInformationDetail">
<link:definition>1039 - Disclosure - Goodwill and Other Intangible Assets, Net - Additional Information (Detail)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/AccruedExpensesAndOtherLiabilitiesSummaryOfAccruedExpensesAndOtherLiabilitiesDetail" id="AccruedExpensesAndOtherLiabilitiesSummaryOfAccruedExpensesAndOtherLiabilitiesDetail">
<link:definition>1040 - Disclosure - Accrued Expenses and Other Liabilities - Summary of Accrued Expenses and Other Liabilities (Detail)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/DebtAdditionalInformationDetail" id="DebtAdditionalInformationDetail">
<link:definition>1041 - Disclosure - Debt - Additional Information (Detail)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/LeasesAdditionalInformationDetail" id="LeasesAdditionalInformationDetail">
<link:definition>1042 - Disclosure - Leases - Additional Information (Detail)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/LeasesSupplementalCashFlowInformationToOperatingLeasesDetails" id="LeasesSupplementalCashFlowInformationToOperatingLeasesDetails">
<link:definition>1043 - Disclosure - Leases - Supplemental Cash flow Information to operating leases (Details)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/LeasesMaturitiesOfOperatingLeaseLiabilitiesDetails" id="LeasesMaturitiesOfOperatingLeaseLiabilitiesDetails">
<link:definition>1044 - Disclosure - Leases - Maturities of Operating Lease Liabilities (Details)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/StockholdersEquityAdditionalInformationDetail" id="StockholdersEquityAdditionalInformationDetail">
<link:definition>1045 - Disclosure - Stockholders' Equity - Additional Information (Detail)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/StockholdersEquityComputationOfBasicAndDilutedEarningsPerShareDetail" id="StockholdersEquityComputationOfBasicAndDilutedEarningsPerShareDetail">
<link:definition>1046 - Disclosure - Stockholders' Equity - Computation of Basic and Diluted Earnings Per Share (Detail)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/StockholdersEquityAntidilutiveSecuritiesExcludedFromComputationOfEarningsPerShareDetail" id="StockholdersEquityAntidilutiveSecuritiesExcludedFromComputationOfEarningsPerShareDetail">
<link:definition>1047 - Disclosure - Stockholders' Equity - Antidilutive Securities Excluded from Computation of Earnings Per Share (Detail)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/RevenueFromContractsWithCustomersAdditionalInformationDetail" id="RevenueFromContractsWithCustomersAdditionalInformationDetail">
<link:definition>1048 - Disclosure - Revenue From Contracts With Customers - Additional Information (Detail)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/RevenueFromContractsWithCustomersSummaryOfDisaggregatedNetSalesDetail" id="RevenueFromContractsWithCustomersSummaryOfDisaggregatedNetSalesDetail">
<link:definition>1049 - Disclosure - Revenue From Contracts With Customers - Summary of Disaggregated Net Sales (Detail)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/StockBasedCompensationAdditionalInformationDetail" id="StockBasedCompensationAdditionalInformationDetail">
<link:definition>1050 - Disclosure - Stock-Based Compensation - Additional Information (Detail)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/StockBasedCompensationSummaryOfStockBasedCompensationGrantsDetail" id="StockBasedCompensationSummaryOfStockBasedCompensationGrantsDetail">
<link:definition>1051 - Disclosure - Stock-Based Compensation - Summary of Stock-Based Compensation Grants (Detail)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/StockBasedCompensationSummaryOfAssumptionsUsedToEstimateFairValueOfEachSarDetail" id="StockBasedCompensationSummaryOfAssumptionsUsedToEstimateFairValueOfEachSarDetail">
<link:definition>1052 - Disclosure - Stock-Based Compensation - Summary of Assumptions Used to Estimate Fair Value of Each SAR (Detail)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/StockBasedCompensationSummaryOfStockBasedCompensationExpensesDetail" id="StockBasedCompensationSummaryOfStockBasedCompensationExpensesDetail">
<link:definition>1053 - Disclosure - Stock-Based Compensation - Summary of Stock-Based Compensation Expenses (Detail)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/IncomeTaxesAdditionalInformationDetail" id="IncomeTaxesAdditionalInformationDetail">
<link:definition>1054 - Disclosure - Income Taxes - Additional Information (Detail)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/SegmentInformationAdditionalInformationDetail" id="SegmentInformationAdditionalInformationDetail">
<link:definition>1055 - Disclosure - Segment Information - Additional Information (Detail)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/SegmentInformationDetailsOfSegmentInformationDetail" id="SegmentInformationDetailsOfSegmentInformationDetail">
<link:definition>1056 - Disclosure - Segment Information - Details of Segment Information (Detail)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/SegmentInformationScheduleOfReconciliationOfNetIncomeToEbitdaDetail" id="SegmentInformationScheduleOfReconciliationOfNetIncomeToEbitdaDetail">
<link:definition>1057 - Disclosure - Segment Information - Schedule of Reconciliation of Net Income to EBITDA (Detail)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/CommitmentsAndContingenciesAdditionalInformationDetail" id="CommitmentsAndContingenciesAdditionalInformationDetail">
<link:definition>1058 - Disclosure - Commitments and Contingencies - Additional Information (Detail)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:roleType roleURI="http://www.trex.com/role/CommitmentsAndContingenciesSummaryOfReconciliationOfCompanysResidentialProductWarrantyReserveDetail" id="CommitmentsAndContingenciesSummaryOfReconciliationOfCompanysResidentialProductWarrantyReserveDetail">
<link:definition>1059 - Disclosure - Commitments and Contingencies - Summary of Reconciliation of Company's Residential Product Warranty Reserve (Detail)</link:definition>
<link:usedOn>link:presentationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:calculationLink</link:usedOn>
</link:roleType>
<link:linkbaseRef xlink:type="simple" xlink:href="trex-20220630_pre.xml" xlink:role="http://www.xbrl.org/2003/role/presentationLinkbaseRef" xlink:arcrole="http://www.w3.org/1999/xlink/properties/linkbase" />
<link:linkbaseRef xlink:type="simple" xlink:href="trex-20220630_def.xml" xlink:role="http://www.xbrl.org/2003/role/definitionLinkbaseRef" xlink:arcrole="http://www.w3.org/1999/xlink/properties/linkbase" />
<link:linkbaseRef xlink:type="simple" xlink:href="trex-20220630_lab.xml" xlink:role="http://www.xbrl.org/2003/role/labelLinkbaseRef" xlink:arcrole="http://www.w3.org/1999/xlink/properties/linkbase" />
<link:linkbaseRef xlink:type="simple" xlink:href="trex-20220630_cal.xml" xlink:role="http://www.xbrl.org/2003/role/calculationLinkbaseRef" xlink:arcrole="http://www.w3.org/1999/xlink/properties/linkbase" />
</appinfo>
</annotation>
<import namespace="http://www.xbrl.org/2003/instance" schemaLocation="http://www.xbrl.org/2003/xbrl-instance-2003-12-31.xsd" />
<import namespace="http://www.xbrl.org/2003/linkbase" schemaLocation="http://www.xbrl.org/2003/xbrl-linkbase-2003-12-31.xsd" />
<import namespace="http://xbrl.org/2005/xbrldt" schemaLocation="http://www.xbrl.org/2005/xbrldt-2005.xsd" />
<import namespace="http://fasb.org/us-gaap/2022" schemaLocation="https://xbrl.fasb.org/us-gaap/2022/elts/us-gaap-2022.xsd" />
<import namespace="http://xbrl.sec.gov/country/2022" schemaLocation="https://xbrl.sec.gov/country/2022/country-2022.xsd" />
<import namespace="http://xbrl.sec.gov/currency/2022" schemaLocation="https://xbrl.sec.gov/currency/2022/currency-2022.xsd" />
<import namespace="http://xbrl.sec.gov/exch/2022" schemaLocation="https://xbrl.sec.gov/exch/2022/exch-2022.xsd" />
<import namespace="http://xbrl.sec.gov/naics/2022" schemaLocation="https://xbrl.sec.gov/naics/2022/naics-2022.xsd" />
<import namespace="http://xbrl.sec.gov/sic/2022" schemaLocation="https://xbrl.sec.gov/sic/2022/sic-2022.xsd" />
<import namespace="http://xbrl.sec.gov/stpr/2022" schemaLocation="https://xbrl.sec.gov/stpr/2022/stpr-2022.xsd" />
<import namespace="http://www.xbrl.org/2009/role/negated" schemaLocation="http://www.xbrl.org/lrr/role/negated-2009-12-16.xsd" />
<import namespace="http://www.xbrl.org/2009/role/net" schemaLocation="http://www.xbrl.org/lrr/role/net-2009-12-16.xsd" />
<import namespace="http://www.xbrl.org/2009/arcrole/fact-explanatoryFact" schemaLocation="http://www.xbrl.org/lrr/arcrole/factExplanatory-2009-12-16.xsd" />
<import namespace="http://xbrl.sec.gov/dei/2022" schemaLocation="https://xbrl.sec.gov/dei/2022/dei-2022.xsd" />
<import namespace="http://fasb.org/us-types/2022" schemaLocation="https://xbrl.fasb.org/us-gaap/2022/elts/us-types-2022.xsd" />
<import namespace="http://fasb.org/srt-types/2022" schemaLocation="https://xbrl.fasb.org/srt/2022/elts/srt-types-2022.xsd" />
<import namespace="http://fasb.org/srt/2022" schemaLocation="https://xbrl.fasb.org/srt/2022/elts/srt-2022.xsd" />
<import namespace="http://www.xbrl.org/dtr/type/2020-01-21" schemaLocation="https://www.xbrl.org/dtr/type/2020-01-21/types.xsd" />
<element name="AccruedLiabilitiesAndOtherLiabilitiesCurrentExcludingWarranty" type="xbrli:monetaryItemType" abstract="false" xbrli:periodType="instant" nillable="true" id="trex_AccruedLiabilitiesAndOtherLiabilitiesCurrentExcludingWarranty" substitutionGroup="xbrli:item" xbrli:balance="credit" />
<element name="NewAccountingStandardsNotYetAdoptedTextBlock" type="dtr-types:textBlockItemType" abstract="false" xbrli:periodType="duration" nillable="true" id="trex_NewAccountingStandardsNotYetAdoptedTextBlock" substitutionGroup="xbrli:item" />
<element name="PrepaidAndOtherCurrentAssetsDisclosureTextBlock" type="dtr-types:textBlockItemType" abstract="false" xbrli:periodType="duration" nillable="true" id="trex_PrepaidAndOtherCurrentAssetsDisclosureTextBlock" substitutionGroup="xbrli:item" />
<element name="SeasonalityDisclosureTextBlock" type="dtr-types:textBlockItemType" abstract="false" xbrli:periodType="duration" nillable="true" id="trex_SeasonalityDisclosureTextBlock" substitutionGroup="xbrli:item" />
<element name="PrepaidExpenseAndOtherAssetsCurrentTableTextBlock" type="dtr-types:textBlockItemType" abstract="false" xbrli:periodType="duration" nillable="true" id="trex_PrepaidExpenseAndOtherAssetsCurrentTableTextBlock" substitutionGroup="xbrli:item" />
<element name="ScheduleOfAccruedLiabilitiesAndOtherCurrentLiabilitiesTableTextBlock" type="dtr-types:textBlockItemType" abstract="false" xbrli:periodType="duration" nillable="true" id="trex_ScheduleOfAccruedLiabilitiesAndOtherCurrentLiabilitiesTableTextBlock" substitutionGroup="xbrli:item" />
<element name="SupplementalFinancialInformationOfOperatingLeasesTableTextBlock" type="dtr-types:textBlockItemType" abstract="false" xbrli:periodType="duration" nillable="true" id="trex_SupplementalFinancialInformationOfOperatingLeasesTableTextBlock" substitutionGroup="xbrli:item" />
<element name="ScheduleOfReconciliationOfNetIncomeToEBITDATableTextBlock" type="dtr-types:textBlockItemType" abstract="false" xbrli:periodType="duration" nillable="true" id="trex_ScheduleOfReconciliationOfNetIncomeToEBITDATableTextBlock" substitutionGroup="xbrli:item" />
<element name="BillingsInExcessOfRevenuesCurrent" type="xbrli:monetaryItemType" abstract="false" xbrli:periodType="instant" nillable="true" id="trex_BillingsInExcessOfRevenuesCurrent" substitutionGroup="xbrli:item" xbrli:balance="credit" />
<element name="AccruedManufacturingExpensesCurrent" type="xbrli:monetaryItemType" abstract="false" xbrli:periodType="instant" nillable="true" id="trex_AccruedManufacturingExpensesCurrent" substitutionGroup="xbrli:item" xbrli:balance="credit" />
<element name="FourthamendedandrestatedcreditagreementMember" type="dtr-types:domainItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_FourthamendedandrestatedcreditagreementMember" substitutionGroup="xbrli:item" />
<element name="LineOfCreditFacilityAdditionalBorrowingCapacity" type="xbrli:monetaryItemType" abstract="false" xbrli:periodType="instant" nillable="true" id="trex_LineOfCreditFacilityAdditionalBorrowingCapacity" substitutionGroup="xbrli:item" xbrli:balance="credit" />
<element name="NumberOfBusinessDaysWithinWhichLenderMayRaiseObjectionsToAmendment" type="xbrli:durationItemType" abstract="false" xbrli:periodType="duration" nillable="true" id="trex_NumberOfBusinessDaysWithinWhichLenderMayRaiseObjectionsToAmendment" substitutionGroup="xbrli:item" />
<element name="RevolverLoansPortionEffectiveOneJanuaryThroughThirtyJuneMember" type="dtr-types:domainItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_RevolverLoansPortionEffectiveOneJanuaryThroughThirtyJuneMember" substitutionGroup="xbrli:item" />
<element name="RevolverLoansPortionEffectiveOneJulyThroughThirtyFirstDecemberMember" type="dtr-types:domainItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_RevolverLoansPortionEffectiveOneJulyThroughThirtyFirstDecemberMember" substitutionGroup="xbrli:item" />
<element name="AgreementAxis" type="xbrli:stringItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_AgreementAxis" substitutionGroup="xbrldt:dimensionItem" />
<element name="AgreementDomain" type="dtr-types:domainItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_AgreementDomain" substitutionGroup="xbrli:item" />
<element name="FifthAmendmentAndRestatedAgreementMember" type="dtr-types:domainItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_FifthAmendmentAndRestatedAgreementMember" substitutionGroup="xbrli:item" />
<element name="CreditFacilityOneAxis" type="xbrli:stringItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_CreditFacilityOneAxis" substitutionGroup="xbrldt:dimensionItem" />
<element name="CreditFacilityOneDomain" type="dtr-types:domainItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_CreditFacilityOneDomain" substitutionGroup="xbrli:item" />
<element name="SwinglineLetterOfCreditMember" type="dtr-types:domainItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_SwinglineLetterOfCreditMember" substitutionGroup="xbrli:item" />
<element name="SupplementalBalanceSheetInformationAbstract" type="xbrli:stringItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_SupplementalBalanceSheetInformationAbstract" substitutionGroup="xbrli:item" />
<element name="LesseeOperatingLeasesAccruedExpensesAndOtherCurrentLiabilities" type="xbrli:monetaryItemType" abstract="false" xbrli:periodType="instant" nillable="true" id="trex_LesseeOperatingLeasesAccruedExpensesAndOtherCurrentLiabilities" substitutionGroup="xbrli:item" xbrli:balance="credit" />
<element name="StockRepurchaseProgramMember" type="dtr-types:domainItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_StockRepurchaseProgramMember" substitutionGroup="xbrli:item" />
<element name="ComponentsOfBasicAndDilutedEarningPerShareTable" type="xbrli:stringItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_ComponentsOfBasicAndDilutedEarningPerShareTable" substitutionGroup="xbrldt:hypercubeItem" />
<element name="StockAppreciationRightsMember" type="dtr-types:domainItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_StockAppreciationRightsMember" substitutionGroup="xbrli:item" />
<element name="ComponentsOfBasicAndDilutedEarningPerShareLineItems" type="xbrli:stringItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_ComponentsOfBasicAndDilutedEarningPerShareLineItems" substitutionGroup="xbrli:item" />
<element name="TwoThousandFourteenStockIncentivePlanMember" type="dtr-types:domainItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_TwoThousandFourteenStockIncentivePlanMember" substitutionGroup="xbrli:item" />
<element name="PerformanceBasedRestrictedStockAndPerformanceBasedRestrictedStockUnitsMember" type="dtr-types:domainItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_PerformanceBasedRestrictedStockAndPerformanceBasedRestrictedStockUnitsMember" substitutionGroup="xbrli:item" />
<element name="PerformanceBasedRestrictedStockAdjustmentMember" type="dtr-types:domainItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_PerformanceBasedRestrictedStockAdjustmentMember" substitutionGroup="xbrli:item" />
<element name="ShareBasedCompensationArrangementByShareBasedPaymentAwardNonOptionsEquityInstrumentsGrantedWeightedAverageGrantPrice" type="dtr-types:perShareItemType" abstract="false" xbrli:periodType="duration" nillable="true" id="trex_ShareBasedCompensationArrangementByShareBasedPaymentAwardNonOptionsEquityInstrumentsGrantedWeightedAverageGrantPrice" substitutionGroup="xbrli:item" />
<element name="PerformanceBasedRestrictedStockUnitsMember" type="dtr-types:domainItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_PerformanceBasedRestrictedStockUnitsMember" substitutionGroup="xbrli:item" />
<element name="TimeBasedRestrictedStockUnitsMember" type="dtr-types:domainItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_TimeBasedRestrictedStockUnitsMember" substitutionGroup="xbrli:item" />
<element name="ShareBasedCompensationArrangementByShareBasedPaymentAwardFairValueAssumptionsAndMethodologyTable" type="xbrli:stringItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_ShareBasedCompensationArrangementByShareBasedPaymentAwardFairValueAssumptionsAndMethodologyTable" substitutionGroup="xbrldt:hypercubeItem" />
<element name="ShareBasedCompensationArrangementByShareBasedPaymentAwardFairValueAssumptionsAndMethodologyLineItems" type="xbrli:stringItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_ShareBasedCompensationArrangementByShareBasedPaymentAwardFairValueAssumptionsAndMethodologyLineItems" substitutionGroup="xbrli:item" />
<element name="TimeBasedRestrictedStockandRestrictedstockUnitsMember" type="dtr-types:domainItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_TimeBasedRestrictedStockandRestrictedstockUnitsMember" substitutionGroup="xbrli:item" />
<element name="PerformanceBasedRestrictedStockAndrestrictedStockunitsMember" type="dtr-types:domainItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_PerformanceBasedRestrictedStockAndrestrictedStockunitsMember" substitutionGroup="xbrli:item" />
<element name="EmployeeStockPurchasePlanMember" type="dtr-types:domainItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_EmployeeStockPurchasePlanMember" substitutionGroup="xbrli:item" />
<element name="ExcessTaxBenefitsFromStockBasedAwards" type="xbrli:monetaryItemType" abstract="false" xbrli:periodType="duration" nillable="true" id="trex_ExcessTaxBenefitsFromStockBasedAwards" substitutionGroup="xbrli:item" xbrli:balance="credit" />
<element name="CapitalExpenditure" type="xbrli:monetaryItemType" abstract="false" xbrli:periodType="duration" nillable="true" id="trex_CapitalExpenditure" substitutionGroup="xbrli:item" xbrli:balance="credit" />
<element name="EBITDA" type="xbrli:monetaryItemType" abstract="false" xbrli:periodType="duration" nillable="true" id="trex_EBITDA" substitutionGroup="xbrli:item" xbrli:balance="credit" />
<element name="ScheduleOfCommitmentsAndContingenciesTable" type="xbrli:stringItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_ScheduleOfCommitmentsAndContingenciesTable" substitutionGroup="xbrldt:hypercubeItem" />
<element name="SurfaceFlakingWarrantyReserveMember" type="dtr-types:domainItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_SurfaceFlakingWarrantyReserveMember" substitutionGroup="xbrli:item" />
<element name="CommercialUseMember" type="dtr-types:domainItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_CommercialUseMember" substitutionGroup="xbrli:item" />
<element name="ScheduleOfCommitmentsAndContingenciesLineItems" type="xbrli:stringItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_ScheduleOfCommitmentsAndContingenciesLineItems" substitutionGroup="xbrli:item" />
<element name="SensitivityChangeInSurfaceFlakingWarrantyReserve" type="xbrli:monetaryItemType" abstract="false" xbrli:periodType="instant" nillable="true" id="trex_SensitivityChangeInSurfaceFlakingWarrantyReserve" substitutionGroup="xbrli:item" xbrli:balance="credit" />
<element name="WarrantyPeriod" type="xbrli:durationItemType" abstract="false" xbrli:periodType="duration" nillable="true" id="trex_WarrantyPeriod" substitutionGroup="xbrli:item" />
<element name="PercentSensitivityChangeInExpectedSurfaceFlakingClaims" type="dtr-types:percentItemType" abstract="false" xbrli:periodType="duration" nillable="true" id="trex_PercentSensitivityChangeInExpectedSurfaceFlakingClaims" substitutionGroup="xbrli:item" />
<element name="CommercialRailingAndStagingSystemsMember" type="dtr-types:domainItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_CommercialRailingAndStagingSystemsMember" substitutionGroup="xbrli:item" />
<element name="SurfaceFlakingMember" type="dtr-types:domainItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_SurfaceFlakingMember" substitutionGroup="xbrli:item" />
<element name="OtherResidentialMember" type="dtr-types:domainItemType" abstract="true" xbrli:periodType="duration" nillable="true" id="trex_OtherResidentialMember" substitutionGroup="xbrli:item" />
</schema>
