From 3e34d018e1f93c3736c1aec57677b1ab18e945c0 Mon Sep 17 00:00:00 2001 From: Lewin Kelly Date: Sat, 4 Nov 2023 23:56:27 +0000 Subject: [PATCH] Improve rendering, use MSAA, render headshots with RCC, and attempt to render shirts and pants correctly --- defs.d.lua | 6 +++++- luau/join.luau | 4 ++-- luau/renderAvatar.luau | 32 +++++++++++++++++++++++++++++--- luau/renderClothing.luau | 8 ++++---- 4 files changed, 40 insertions(+), 10 deletions(-) diff --git a/defs.d.lua b/defs.d.lua index d7470f8..541823c 100644 --- a/defs.d.lua +++ b/defs.d.lua @@ -3226,7 +3226,8 @@ declare class PathWaypoint end declare class CFrame - LookVector: Vector3 + lookVector: Vector3 + LookVector: Vector3 -- ? Position: Vector3 RightVector: Vector3 Rotation: CFrame @@ -5661,6 +5662,9 @@ declare class InsertService extends Instance function LoadLocalAsset(self, assetPath: string): Instance function LoadPackageAsset(self, url: Content): { Instance } function LoadPackageAssetAsync(self, url: Content): { Instance } + + function SetAssetUrl(self, assetUrl: Content): nil + function SetAssetVersionUrl(self, assetVersionUrl: Content): nil end declare class JointInstance extends Instance diff --git a/luau/join.luau b/luau/join.luau index 52b91d7..bbc1973 100644 --- a/luau/join.luau +++ b/luau/join.luau @@ -54,8 +54,8 @@ ContentProvider:SetThreadPool(16) InsertService:SetBaseSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=10&type=base" InsertService:SetUserSetsUrl "http://banland.xyz/game/tools/insertasset?nsets=20&type=user&userid=%d" InsertService:SetCollectionUrl "http://banland.xyz/game/tools/insertasset?sid=%d" -InsertService:SetAssetUrl "http://banland.xyz/Asset/?id=%d" -InsertService:SetAssetVersionUrl "http://banland.xyz/Asset/?assetversionid=%d" +InsertService:SetAssetUrl "http://banland.xyz/asset?id=%d" +InsertService:SetAssetVersionUrl "http://banland.xyz/asset?assetversionid=%d" pcall(function() SocialService:SetFriendUrl "http://banland.xyz/Game/LuaWebService/HandleSocialRequest.ashx?method=IsFriendsWith&playerid=%d&userid=%d" diff --git a/luau/renderAvatar.luau b/luau/renderAvatar.luau index b7096fc..ec54bbf 100644 --- a/luau/renderAvatar.luau +++ b/luau/renderAvatar.luau @@ -53,10 +53,36 @@ if gear then player.Character.Torso["Right Shoulder"].CurrentAngle = math.rad(90) end -local click = ThumbnailGenerator:Click("PNG", 420, 420, true) +local clickBody = ThumbnailGenerator:Click("PNG", 840, 840, true) -local result = '{"Status": "Completed", "Click": "' .. tostring(click) .. '"}' -print("[" .. game.JobId .. "] Successfully rendered, moving on...") +print("[" .. game.JobId .. "] Rendered bodyshot") + +player.Character.Torso["Right Shoulder"].CurrentAngle = 0 + +-- Headshot Camera +local FOV = 52.5 + +local CameraAngle = player.Character.Head.CFrame +local CameraPosition = CameraAngle + + CFrame.Angles(0, math.pi, 0).lookVector.unit * 2.75 + +local Camera = Instance.new "Camera" +Camera.Name = "ThumbnailCamera" +Camera.CameraType = Enum.CameraType.Scriptable +Camera.CoordinateFrame = CFrame.new(CameraPosition.p, CameraAngle.p) +Camera.FieldOfView = FOV +Camera.Parent = player.Character +workspace.CurrentCamera = Camera + +local clickHead = ThumbnailGenerator:Click("PNG", 300, 300, true) + +local result = '{"Status": "Completed", "ClickBody": "' + .. tostring(clickBody) + .. '", "ClickHead": "' + .. tostring(clickHead) + .. '"}' + +print("[" .. game.JobId .. "] Rendered headshot") while true do local ok, err = pcall(function() diff --git a/luau/renderClothing.luau b/luau/renderClothing.luau index e5e316a..7934d99 100644 --- a/luau/renderClothing.luau +++ b/luau/renderClothing.luau @@ -14,10 +14,8 @@ local ScriptContext = game:GetService "ScriptContext" pcall(function() ContentProvider:SetBaseUrl(baseUrl) - InsertService:SetAssetUrl(baseUrl .. "/asset/assetfetch?id=%d") - InsertService:SetAssetVersionUrl( - baseUrl .. "/asset/assetfetch?assetversionid=%d" - ) + InsertService:SetAssetUrl(baseUrl .. "/asset?id=%d") + InsertService:SetAssetVersionUrl(baseUrl .. "/asset?assetversionid=%d") end) HttpService.HttpEnabled = true @@ -46,6 +44,8 @@ local player = game:GetService("Players"):CreateLocalPlayer(0) player.CharacterAppearance = baseUrl .. "/api/render/characterasset?id=" .. assetId + .. "&apiKey=" + .. thumbnailKey player:LoadCharacter(false) -- Raise up the character's arm if they have gear.