รัน Virtualized OS บน Host มีอยู่จริง สนุก Cool ทดลอง Software ก่อน Commit Real Platform ทำสิ่งที่ไม่กล้าทำ ปลอดภัย ลด Cost Deployment แต่ขาด 3D Acceleration สำหรับ Guest OS... หรือ "เคย" ขาด ตอนนี้ 3D Acceleration ใน VMs เป็นจริงแล้ว!

บทนำ
ซีรีส์นี้จะแสดง Simple Hacks ให้ 3D Acceleration Enabled ใน Guest OS! VMs ไม่จำกัด 2D Apps เพลิดเพลิน Rich Interactive Desktops สุดท้าย: เล่น Games ใน VMs ได้!
บทความนี้: Enable DirectX Support ใน VMware Server ใช้ได้กับ VMware Player/Workstation ด้วย Host OS ไม่สำคัญ Guest ต้องเป็น Windows
บทความถัดไป: OpenGL Support ใน VirtualBox Host Windows/Linux OK Guest Windows ทั้งคู่จำกัด Windows Guest บทความที่ 3: VMGL สำหรับ Linux Guests บน Linux Hosts
คำเตือน...
Features ทั้งหมด (และ Solutions) ยัง Experimental Setup อาจทำงานได้ - หรือไม่ Integration และ Performance ไม่ Perfect
3D Virtualization ยัง Infancy แต่วิ่งหน้าดี เราจะได้ Perfect 3D Graphics Support เร็วๆ นี้ ตอนนี้ลองดูทำได้ไหน Let's rock!
รอ! ผมรู้ Virtualization น้อยมาก!
ถ้า Newbie บทความนี้ (หรือซีรีส์) อาจ Advanced เกิน อ่าน Virtualization Section ให้คล่องก่อน โดยเฉพาะ:
- How to install VMware Tools
- Installing Windows XP - Full Tutorial - Install Windows XP เหมือนกันทั้ง Real Host และ VM
ผมพยายามทำ Tutorial ให้ง่ายและ Detailed ให้ Follow ได้ทุกคน
VMware Server & DirectX
ต้องการอะไร?
- VMware Product: Player, Server, Workstation (Mutually Exclusive - ติดตั้งได้อย่างใดอย่างหนึ่ง) ผมเลือก:
- VMware Server 1.0.5 on Windows XP3 Host (Windows Host Example)
- VMware Server 1.0.8 on openSUSE 11.0 Host (Linux Host Example)
- Windows XP SP3 Guest ทั้งสองกรณี
- VMware Tools ติดตั้งใน Guest
- Small Tweak VM Config File (.vmx)
- Game ต้องการ DirectX ทดสอบ
Note: ถ้าใช้ VMware Player ต้องแน่ใจว่า Windows VM มี VMware Tools ติดตั้งแล้ว
Assume Ready (Steps 1-4) มา Tweak .vmx Config File ไม่แน่ใจ Steps 1-4 อ้าง Virtualization Section
Enable 3D Acceleration สำหรับ VM
VMs มี Config Files (.vmx) Text Files Directives Syntax ที่ VMware Programs Interpret กำหนด CPUs, RAM, Hard Disk
Edit .vmx เฉพาะตอน VM Powered Off! หาโฟลเดอร์ VMs หา .vmx เปิดใน Text Editor
เพิ่ม Section Enable 3D:
mks.enable3d = TRUE
บรรทัดนี้ Enable 3D Acceleration
svga.vramSize = 67108864
Optional: VRAM สำหรับ Virtual GPU ตัวอย่าง 64MB ถ้าอยาก Precise 32MB คำนวณ 32 x 1024 x 1024 (1KB = 1024 bytes) Max 128MB
vmmouse.present = FALSE
Optional: Disable Mouse Integration สำคัญสำหรับ Games บางเกม Full-screen Real-time FPS
พร้อมกับ Option 3: Turn Off Motion Grabbing ใน VMware Console: Edit > Preferences > Input Tab > Cursor > Untick "Ungrab when cursor leaves window"

ฟังก์ชัน: ป้องกัน Games จำ Mouse Motion ตอน Mouse ออกจาก VM เช่น Move Mouse ขวา Game ไม่ Push ขวาต่อ Games ใช้ Mouse Scroll Map ไม่ Scroll ต่อ FPS ใช้ Mouse Aiming ไม่หมุนหมากรอก
สุดท้าย File ควรมี Section แบบนี้:

พร้อม Boot และ Test!
Windows Host, Windows Guest
Boot Virtual Machine
Boot แล้ว เช็ค VMware Tools Installed/Running (VMware Icon ใน System Tray)

Run dxdiag (Start > Run > dxdiag) เช็ค Display Diagnostics:

DirectX Features: DirectDraw และ Direct3D Enabled AGP Texture Acceleration ไม่มี พอใจ ไม่ใช่ Best แตพอ Under Device: VMware Driver 64MB RAM
Test Game
Candidates: Max Payne และ Scorched3D


ทำงาน OK Performance Reasonable ไม่ Smooth/Fast เท่า Native แต Step In Right Direction
Linux Host, Windows Guest
ทำงานบน Linux เช่นกัน ไม่แค่นั้น ผม Remote Connect ไป Windows Machine ที่ VM อยู่ รันผ่าน Wireless!


สรุป
Setup เรียบง่าย 3D Acceleration ทำงาน ประมาณ Equivalent GeForce 2/4 Card อาจนิดหน่อยมากกว่า คิดว่าเป็นเด็กโตเป็น 3D Bully Step สำคัญสำหรับ Hardcore Virtualization Fans บทความต่อไป: VirtualBox & OpenGL
Enjoy.